From 39bbd2f039d1c0583ad24e8a546ca52819dcf026 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Wed, 12 Aug 2026 23:20:45 +0200 Subject: [PATCH] chore(quality): point PHPMD at the central ruleset phpmd.xml becomes a 9-line stub referencing vendor/conduction/hydra-gates/quality-config/phpmd.xml, and the local phpmd-unusedparams.xml is deleted in favour of the central copy, which the unused-parameters leg of the composer phpmd script now points at. Both legs, their flags and the worst-exit-code behaviour are unchanged. --- composer.json | 2 +- phpmd-unusedparams.xml | 40 -------------- phpmd.xml | 122 ++--------------------------------------- 3 files changed, 5 insertions(+), 159 deletions(-) delete mode 100644 phpmd-unusedparams.xml diff --git a/composer.json b/composer.json index c0b38497..289381fa 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "phpcs": "./vendor/bin/phpcs --standard=phpcs.xml", "phpcs:fix": "./vendor/bin/phpcbf --standard=phpcs.xml", "phpcs:output": "./vendor/bin/phpcs --standard=phpcs.xml --report=json lib/ 2>/dev/null | tail -1 > phpcs-output.json", - "phpmd": "E=0; ./vendor/bin/phpmd lib text phpmd.xml --baseline-file phpmd.baseline.xml || E=$?; ./vendor/bin/phpmd lib text phpmd-unusedparams.xml --baseline-file phpmd.baseline.xml || E=$?; exit $E", + "phpmd": "E=0; ./vendor/bin/phpmd lib text phpmd.xml --baseline-file phpmd.baseline.xml || E=$?; ./vendor/bin/phpmd lib text vendor/conduction/hydra-gates/quality-config/phpmd-unusedparams.xml --baseline-file phpmd.baseline.xml || E=$?; exit $E", "phpmetrics": "./vendor/bin/phpmetrics --report-html=phpmetrics lib/", "phpmetrics:violations": "./vendor/bin/phpmetrics --violations-xml=phpmetrics/violations.xml lib/", "psalm": "if [ -f vendor/bin/psalm ]; then ./vendor/bin/psalm --threads=1 --no-cache; else echo 'Psalm not installed, skipping...'; fi", diff --git a/phpmd-unusedparams.xml b/phpmd-unusedparams.xml deleted file mode 100644 index a109ae4e..00000000 --- a/phpmd-unusedparams.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - Second PHPMD leg: UnusedFormalParameter only. - - This rule lives in its own ruleset because PHPMD honours <exclude-pattern> - ONLY as a direct child of <ruleset>; nested inside a <rule> it is parsed and - discarded (ConductionNL/.github#155). A direct child, however, is applied by - PDepend at file-collection time and drops the file from EVERY rule in the - ruleset. Isolating UnusedFormalParameter here means the lib/Migration - exclusion applies to this rule and this rule ALONE - every other rule still - analyses lib/Migration in the main leg. - - Why lib/Migration is excluded from THIS rule: OCP\Migration\IMigrationStep - mandates changeSchema(IOutput $output, Closure $schemaClosure, array $options) - and preSchemaChange/postSchemaChange with the same three parameters. A step - that needs none of them still cannot drop them. The signature cannot change. - - The pattern is */lib/Migration/* and deliberately NOT */Migration/* or - *Migration*. Those broader forms silently swallow ORDINARY CLASSES that merely - have "Migration" in their path - measured on openconnector, */Migration/* hides - a genuine finding in lib/Service/Migration/, and *Migration* additionally hides - every lib/Service/MigrationService.php, lib/Controller/MigrationController.php - and lib/Db/*Migration*.php. Those have no mandated signature and must stay - analysed. Only the app's own lib/Migration/ directory holds IMigrationStep - implementations, so only that directory is exempted. - - Both legs must always run - see the "phpmd" script in composer.json, which - keeps the worst exit code rather than letting the first leg short-circuit - the second. - - - */lib/Migration/* - - - diff --git a/phpmd.xml b/phpmd.xml index 5cea97ec..29d267a8 100644 --- a/phpmd.xml +++ b/phpmd.xml @@ -1,123 +1,9 @@ - + xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_xml_schema.xsd"> + softwarecatalog — Conduction PHPMD ruleset (single source: conduction/hydra-gates). - - This is a custom ruleset for SoftwareCatalog Nextcloud. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +