Skip to content

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

@simonsan

Description

@simonsan

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions