Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "--include" command line option #989

Closed
andrey-tech opened this issue Nov 13, 2022 · 4 comments · Fixed by #990
Closed

Add "--include" command line option #989

andrey-tech opened this issue Nov 13, 2022 · 4 comments · Fixed by #990
Milestone

Comments

@andrey-tech
Copy link
Contributor

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
@tvbeek
Copy link
Member

tvbeek commented Nov 13, 2022

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)?

@andrey-tech
Copy link
Contributor Author

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.

@kylekatarnls
Copy link
Member

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. 👍

@kylekatarnls
Copy link
Member

Thank you 🙏

@kylekatarnls kylekatarnls added this to the 2.14.0 milestone Sep 26, 2023
tvbeek added a commit to tvbeek/phpmd that referenced this issue Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants