Add "--include" command line option
andrey-tech opened this issue · comments
I have a large project at the moment and I need to scan only files, which changed from previous commit in current branch before new commit. With PHP Code Sniffer and Psalm, I use a list of changed files in command line.
So, it would be good to have a command line option like --include
:
--include - Comma-separated string with list of files and/or directories to check.
Use asterisks to include by pattern.
For example: src/foo/bar.php,src/foo/baz/*
Usage example:
~ $ phpmd src ansi phpmd.xml --include src/foo/one.php,src/foo/two.php,src/foo/three.php
Hello @andrey-tech ,
I understand your idea but I have a question.
Isn't it what you get if you put the files on the first parameter (where you have the src)?
Hello @tvbeek ,
Thanks, this works! This behavior was not obvious for me from documentation:
Command line usage
Type phpmd [filename|directory] [report format] [ruleset file], i.e: :
You can pass a file name or a directory name containing PHP source code to PHPMD.
Please, update documentation like:
Type phpmd [filename|directory[,filename|directory[,...]]] [report format] [ruleset file], i.e: :
You can pass a comma-separated string with list of file names or a directory names containing PHP source code to PHPMD.
Thanks for the report.
Contributions to the documentation are very welcome, a simple search in GitHub will give you the files where this appears:
https://github.com/phpmd/phpmd/search?q=You+can+pass+a+file+name+or+a+directory+name+containing+PHP+source+code+to+PHPMD
And you can make the edit right from the GitHub interface. 👍
Thank you 🙏