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

--filter={gitmodified, gitstaged} is case-sensitive #3877

Closed
2 of 3 tasks
simonsan opened this issue Aug 19, 2023 · 4 comments · Fixed by #3879
Closed
2 of 3 tasks

--filter={gitmodified, gitstaged} is case-sensitive #3877

simonsan opened this issue Aug 19, 2023 · 4 comments · Fixed by #3879

Comments

@simonsan
Copy link
Contributor

Describe the bug

2023-08-19 03_45_26-Usage · squizlabs_PHP_CodeSniffer Wiki — Mozilla Firefox

The documentation says, that a filter parameter can have one of the values {gitmodified, gitstaged}.

Code sample

phpcs -q --report=checkstyle --standard=PSR12 --filter=gitmodified --file-list=.phpcsinclude --tab-width=4 --parallel=10 | cs2pr

To reproduce

Steps to reproduce the behavior:

  1. run the command above
  2. See error message displayed
PHP Fatal error:  Uncaught Error: Class "\PHP_CodeSniffer\Filters\gitmodified" not found in phar:///usr/local/bin/phpcs/src/Files/FileList.php:3
Stack trace:
#0 phar:///usr/local/bin/phpcs/src/Files/FileList.php(3): PHP_CodeSniffer\Files\FileList->addFile()
#1 phar:///usr/local/bin/phpcs/src/Runner.php(3): PHP_CodeSniffer\Files\FileList->__construct()
#2 phar:///usr/local/bin/phpcs/src/Runner.php(3): PHP_CodeSniffer\Runner->run()
#3 /usr/local/bin/phpcs(6): PHP_CodeSniffer\Runner->runPHPCS()
#4 {main}
  thrown in phar:///usr/local/bin/phpcs/src/Files/FileList.php on line 3

Expected behaviour

The documentation states valid values. In this case: {GitModified, GitStaged}. Or the input value is converted to PascalCase.

Please confirm:

  • I have searched the issue list and am not opening a duplicate issue.
  • I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
  • I have verified the issue still exists in the master branch of PHP_CodeSniffer.
@jrfnl
Copy link
Contributor

jrfnl commented Aug 19, 2023

@simonsan Good catch! Would you like to submit a PR to fix this ? (the CLI documentation)

@jrfnl
Copy link
Contributor

jrfnl commented Aug 19, 2023

FYI: For the Wiki, I've just fixed it: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage

@simonsan
Copy link
Contributor Author

@simonsan Good catch! Would you like to submit a PR to fix this ? (the CLI documentation)

Done

@jrfnl
Copy link
Contributor

jrfnl commented Dec 8, 2023

FYI: the fix for this issue is included in today's PHP_CodeSniffer 3.8.0 release.

As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment