Is it possible to have the sniffer output the rule has been broken and therefore which line of my config I can change to stop these violations appearing?
e.g. I am getting a large number of array related violations but I am happy with my array indentation. How can I find out the rule and how do I disable it?
Thanks
494 | ERROR | [x] Array double arrow not aligned correctly; expected
| | 20 space(s) but found 1
495 | ERROR | [x] Array key not aligned correctly; expected 19
| | spaces but found 12
495 | ERROR | [x] Array double arrow not aligned correctly; expected
| | 22 space(s) but found 1
496 | ERROR | [x] Array key not aligned correctly; expected 19
| | spaces but found 12
496 | ERROR | [x] Array double arrow not aligned correctly; expected
| | 25 space(s) but found 1
497 | ERROR | [x] Array key not aligned correctly; expected 19
| | spaces but found 12
Use the -s
argument, it's listed under "Printing Full and Summary Reports" in the docs.
e.g. phpcs -s myfile.php
To answer the second part of your question, there are multiple ways to ignore specific sniffs. You can do it inline using comments and the phpcs:disable
syntax, or you can use command line arguments to exclude specific sniffs which seems like more what you want:
phpcs --exclude=Generic.PHP.LowerCaseConstant,Some.Other.Rule myfile.php