If I run:
phpcs -s ...
I get output in part like this:
1082 | ERROR | Missing parameter type (Drupal.Commenting.FunctionComment.MissingParamType)
If I want to exclude this sniff, I think I ought to be able to run:
phpcs --exclude=Drupal.Commenting.FunctionComment.MissingParamType ...
But when I do, I get, in part:
ERROR: The specified sniff code "Drupal.Commenting.FunctionComment.MissingParamType" is invalid
How do I exclude this sniff?
Comments
Comment #2
earelin commentedI have the same problem
Comment #3
kunalkursija commentedWhat version of PHPCS are you using?
If you refer this documentation https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file then it says the following:
If your PHPCS version is lesser than 3.2.0, then excluding specific sniffs might not be done?
Comment #4
liam morlandI'm running 3.4.1.
Comment #5
klausiWith the --exclude option you can only exclude full sniffs like Drupal.Commenting.FunctionComment. You cannot exclude parts like Drupal.Commenting.FunctionComment.MissingParamType.
To do that you need create a phpcs.xml.dist file in your project, see https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset or https://git.drupalcode.org/project/drupal/blob/8.8.x/core/phpcs.xml.dist for example.
Comment #6
liam morlandThanks