Closed malcomio closed 1 year ago
This seems to be specific to certain file extensions - .inc is checked as expected, but .module
and .install
are not
The phpmd task currently has no support for the --suffixes
flag.
It shouldn't be too hard to add it.
Care to give it a spin?
https://github.com/phpro/grumphp/blob/v2.x/src/Task/PhpMd.php
As far as I can see, the changes in https://github.com/phpro/grumphp/compare/v2.x...malcomio:grumphp:extensions?expand=1 should work, but the other file types are still not being checked
debugging inside \GrumPHP\Process\ProcessBuilder::buildProcess
, I can see the arguments being set as I'd expect:
[commandline:Symfony\Component\Process\Process:private] => Array
(
[0] => /Users/mayoung/Code/grumphp-test/vendor/bin/phpmd
[1] => docroot/test.inc,docroot/test.install,docroot/test.module,docroot/test.php
[2] => ansi
[3] => phpmd.xml
[4] => --suffixes 'php,module,inc,install,test,profile,theme'
)
I must be missing something...
The process building handles escaping for you per argument. You don't need to add quotes yourself. You probably need to make sure that --suffixes and the list of extensions are 2 separate arguments? (I don't use that tool, so you might need to consult the docs of phpmd on how to use that flag)
Thanks - they did indeed need to be separate arguments
I've created #1103 with these changes
relevant PHPMD docs are at https://phpmd.org/documentation/index.html
--suffixes - Comma-separated string of valid source code filename extensions, e.g. php, phtml.
My configuration See https://github.com/malcomio/grumphp-test/blob/main/grumphp.yml
Steps to reproduce:
composer install
in the repo directoryvendor/bin/grumphp run --tasks phpmd
Expected result Problems should be reported in
test.module
andtest.php
, as they are when running PHPMD directly with the--suffixes
flag:Actual result Problems are only reported in
test.php