-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
False positives on Style:Documentation #751
Comments
The parser attaches comment nodes to the code node which follows them. If there is something between the comment and the |
"A file documentation/licence header is not the same as class documentation comment IMO, so I wouldn't consider this a bug." That's exactly the bug. The license header is not class documentation, yet in the case of the second example, the Documentation cop thinks it is. Just because there is a comment above a class/method with a blank line between the two, doesn't mean it's documentation. I would expect rubocop to flag this class as having no documentation:
To not be in violation of a Documentation cop, I would expect this to be the correct format:
|
I agree with @claco. I think it is a bug that the file documentation count as class documentation is this case. |
@jonas054 Indeed. Will you volunteer to have a look at it? |
Yes! |
[Fix #751] Let Documentation cop require class comment to be adjacent
Nice! |
Real head-scratcher there; if anyone has pointers, I'm all ears. Thanks. |
The Style::Documentation cop seems to flag seemingly similar ruby files differently based on how it determines what is and isn't documentation for a class.
For example, this file raises a documentation cop violation:
Not shocking. This can be mitigated with:
However, once I hit a cookbook with e recipe that did not have a
require
statement, I not longer get the Documentation cop violation, but I expected to:yields:
This seems like a bug. The comments at the top of the file are not documentation for
class ::Chef::Recipe
. The trick is teaching rubocop that is true. :-)I don't write a log of RDoc, but when I do Yard docs, I've always put the docs on the line directly above the thing being documented (no space between the two).
Thoughts?
The text was updated successfully, but these errors were encountered: