I found myself googling to find this feature, but I don't think it exists.
I'd like to be able to, run PHPCS with standard=PSR2, but exclude, say, Generic.PHP.LowerCaseKeyword.
So for instance phpcs --standard=PSR2 --exclude="LowerCaseKeyword,SomeOtherRule" src/ could be run.
Not sure if you can do this from CLI, but you can create custom standard, which is based on PSR2 and excludes that sniff in it.
@aik099 - Yes, that's how I'm currently doing it, but it would be very nice to be able to do this from the CLI as well.
The actual command line would turn up into a mess pretty quickly (considering, that sniff name along is pretty long) once you exclude few sniffs that way and decide to change existing sniff properties (if that even were possible from CLI).
A --exclude CLI argument would be no more messy than the --sniffs argument. I've seen quite a few rulesets that only exclude one or two sniffs, so this argument may help in those cases. If nothing else, it would help with debugging.
:+1:
I would love to see this feature. Definitely, could be a big help in debugging.
In testing a repo there might be one consistent error that only exists due to B/C issues. Excluding those one or two errors would make it even easier for a repo to enforce all of their other code style standards while they wait to make their B/C change.
I've added this option in now. You can use the format --exclude=sniff,sniff,sniff on the command line to exclude one or more sniffs. It's exactly the same as the --sniffs command line argument, but works the opposite way.
Most helpful comment
I've added this option in now. You can use the format
--exclude=sniff,sniff,sniffon the command line to exclude one or more sniffs. It's exactly the same as the--sniffscommand line argument, but works the opposite way.