Php_codesniffer: Disable PHPDoc sniffing

Created on 27 Jan 2018  路  3Comments  路  Source: squizlabs/PHP_CodeSniffer

Hi,

Sorry I don't find in the doc how to disable PHP Doc sniffing ?
When I run the inspection, I got all my doc commented : it wants me to add a description for every method and method parameter... Most of the time is pretty useless.

The problem is that I can have more than 30 doc warnings on the report, so it's difficult to see what is a real code issue, and what is a doc missing issue.

THanks !

Awaiting Feedback Question

Most helpful comment

I actually had the opposite issue - I switched to PSR2 and then specifically WANTED many (but not all) of the doc comment features back.

For others looking at this, this may help: https://github.com/AliceWonderMiscreations/FileResource/blob/master/psr2.phpcs.xml

It's a simple configuration file that does psr2 w/ doc comment stuff added back in, but since best practice is one class per file, it doesn't do the annoying check for @license, @author, etc. in class doc comment that should already be in file doc comment.

All 3 comments

To do this, you'd need to create and use a custom ruleset instead of just using one of the built-in ones. Or use a built-in standard that doesn't do any comment checking, like the PSR2 standard.

If you want to create a custom coding standard, you'll find some information here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml

If you need help creating one, please let me know what standard you are currently using (use the -v command line argument if you aren't sure) and I can help create one for you.

Thank @gsherwood I'll have a look at this by the end of the week !

I actually had the opposite issue - I switched to PSR2 and then specifically WANTED many (but not all) of the doc comment features back.

For others looking at this, this may help: https://github.com/AliceWonderMiscreations/FileResource/blob/master/psr2.phpcs.xml

It's a simple configuration file that does psr2 w/ doc comment stuff added back in, but since best practice is one class per file, it doesn't do the annoying check for @license, @author, etc. in class doc comment that should already be in file doc comment.

Was this page helpful?
0 / 5 - 0 ratings