-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic.Commenting.DocComment not finding errors when long description is omitted #852
Comments
All DocBlock processing sniffs were rewritten from scratch/removed and now there is |
my ruleset
PHP
only finds
There are many "assertions" in Generic.Commenting.DocComment that aren't being caught here
It caught |
If other words here is what your finding can be called:
Yes, no way to specify relative order for tags.
No way to define tag groups, that consist of one-type or different-type tags
No blank lines between tag groups. Actually there is blank line between short/long description and If you know how to implement even part of that, then it would be really great. I've tried myself, but without much success. |
See DocCommentSniff line 329
for a better example of requiring relative order of tags see Squiz/Sniffs/Commenting/FileCommentSniff.php line 154 which specifies that @package, @subpackage, @author, and @copyright are present and in that order
See DocCommentSniff line 335
Are you saying my PHP example has a blank line (it doesn't) or that the sniff contains that test (it does.. and that's the issue I'm having) The 4 tests I listed are already defined in DocCommentSniff.php.. but don't seem to be working for me / issue with my ruleset / something |
Are you sure, that mentioned sniffs are ever executed? Maybe they are somehow excluded from the ruleset. |
The doc block sniffs were completely rewritten in 2.0, and the Squiz sniffs were significantly relaxed. Most of those changes were made in the 2.0.0a1 release: https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/2.0.0a1 I'll have a look at the |
I found the problem. All of these issue were caused by the comment not having a long description. For some reason, I made the sniff stop processing if there was no long description, which makes no sense. Thanks for finding and reporting this. |
Forgot to post the "after" result. For this code:
Running this command: Now gives this result:
|
Awesome thanks. |
You helped plenty. That's been around for nearly 2 years and nobody else found it. |
Now, when you mention it I understand why /*
* Short description
*
* @param string $test Description.
* @return void
*/ was auto-fixed into /*
* Short description
*
* @param string $test Description.
* @return void
*/ rather than into /*
* Short description
*
* @param string $test Description.
*
* @return void
*/ in my own code. |
^ Ignore that commit for Potential issue with CommentedOutCode. It was for bug #862. |
It unfortunately flags even cases where there is no short or long description before the tags: ``` /** * @SInCE 1.0.0 */ ``` Probably (inadvertently?) caused by squizlabs/PHP_CodeSniffer#852
I'm just coming from v1.5.5 (i know, I know...)
In 1.5.5 there was a sniff to enforce a space between descriptions and params/return/tags
Squiz.Commenting.FunctionComment.SpacingBeforeTags
Somewhere between 1.5.5 and 2.5.0 any such sniff has been removed and the following is allowed:
(There's no longer a sniff to enforce a blank line before
@return
)Did the Squiz standard intentionally change? (I don't see any mention in changelog)
The text was updated successfully, but these errors were encountered: