Description
Describe the bug
Using the -s option shows sniffs in the report, like this:
17 | ERROR | [x] Line indented incorrectly; expected at least 8 spaces, found 4 (PEAR.WhiteSpace.ScopeIndent.Incorrect)
However, passing that sniff name to the --sniffs or --exclude flag produces this error:
ERROR: The specified sniff code "PEAR.WhiteSpace.ScopeIndent.Incorrect" is invalid
It turns out that that's because this isn't a full sniff. Passing PEAR.WhiteSpace.ScopeIndent
DOES work.
Expected behavior
The docs and the behaviour are contradicting each other, and misleading the user. The output for --help says:
-s Show sniff codes in all reports
Therefore the user assumes that the output added by this option consists of sniff codes, and that, for example, 'PEAR.WhiteSpace.ScopeIndent.Incorrect' is one such sniff code.
But help for --sniffs and --excludes options says:
<sniffs> A comma separated list of sniff codes to include or exclude from checking
(all sniffs must be part of the specified standard)
This also says 'sniff codes' but it disagrees with -s on what a sniff code actually consists of!
Versions (please complete the following information)
Operating System | MacOS 10.15] |
PHP version | 8.3 |
PHP_CodeSniffer version | 3.8.1 |
Standard | -- any -- |
Install type | Composer local |
Additional context
Add any other context about the problem here.
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.