Ignoring single PHPCS rule when running from command line
Asked Answered
C

1

6

Scenario

Some times, I want to run PHPCS, but have it ignore one rule, in this case the Camel Case Method Name rule.

I know that I can create a new ruleset which inherits all from another ruleset, and excludes one, but I'd like to do this from the command line if possible.

Question

When running phpcs --standard=PSR2 --extentions=php src/, is there a way to exclude a single rule from the standard for this run?

Contemplative answered 26/2, 2016 at 12:54 Comment(1)
There is no way to currently do this. The CLI only allows you to selectively include sniffs and not to exclude them. But it's a good idea for a feature. You should consider adding an issue here: github.com/squizlabs/PHP_CodeSnifferWasherwoman
C
5

As of June 29th, 2016, this is now possible.

To exclude specific sniffs, use the flag --exclude=sniff1,sniff2,sniff3.

For more information, see GitHub issue and commit.

Contemplative answered 29/6, 2016 at 10:42 Comment(1)
To find out the sniff names: phpcs -e will list the sniffs, so that you can copy-and-paste them to the --exclude argument.Sukkoth

© 2022 - 2024 — McMap. All rights reserved.