squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.66k stars 1.48k forks source link

Allow wildcard/patterns/group run for --sniffs #1969

Open kenorb opened 6 years ago

kenorb commented 6 years ago

Specifying --sniffs=Squiz.WhiteSpace shows sniff as invalid. I would expect it'll run all sniffs in that category.

When I run:

phpcbf --standard=Squiz --sniffs='Squiz.WhiteSpace.*' src/

it's running, but I've got:

No fixable errors were found

However when I run:

phpcbf --standard=Squiz --sniffs=Squiz.WhiteSpace.SuperfluousWhitespace src/

it works.

gsherwood commented 6 years ago

The --sniffs command line argument has always required full sniff codes, as is documented everywhere like that. That's why partial codes or wildcards are not working for you. Those are not sniff codes.

However, being able to use partial codes is something I've been thinking about building for a while, so I'm going to leave this open a feature request. I have no idea when I'd ever get around to it, but it's a nice feature to have for debugging at least.