Find phpcs rule name by its error message

327 Views Asked by At

Maintaining some legacy code, phpcs (in Vim, using Syntastic) shows a lot of errors. I'd like to suppress them (for now). I get errors like:

participant.php|1 col 1 error| Header blocks must be separated by a single blank line                                                                                                                                                                        
participant.php|5 col 18 error| Expected 1 space(s) after closing parenthesis; found newline
participant.php|7 col 12 error| Space before opening parenthesis of function call prohibited
participant.php|9 col 1 error| Multi-line function call not indented correctly; expected 6 spaces but found 7
participant.php|11 col 1 error| Multi-line function call not indented correctly; expected 4 spaces but found 6
participant.php|12 col 3 error| Expected 1 space after closing brace; newline found
participant.php|13 col 3 error| Expected 1 space(s) after ELSE keyword; newline found
participant.php|15 col 12 error| Space before opening parenthesis of function call prohibited
participant.php|17 col 1 error| Multi-line function call not indented correctly; expected 6 spaces but found 7
participant.php|20 col 1 error| Multi-line function call not indented correctly; expected 4 spaces but found 6

I have a hard time matching the message to the name of a phpcs rule, so I know which rules to use in exclude-patterns.

Does anyone know a easy way to find rules by their error message?

1

There are 1 best solutions below

0
klokop On

I guess I could use the process the file separately on the command line, and use phpcs's -s flag.

phpcs [file] -s

This will show the sniff/rule along with the message.