-
-
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
Documentation for Lint/AmbiguousBlockAssociation cop is confusing #7495
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding! |
This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it. |
Agreed. Actually |
Add example on documentation for `Lint/AmbiguousBlockAssociation` to make clear the possible resolutions
Add example on documentation for `Lint/AmbiguousBlockAssociation` to make clear the possible resolutions
Actual behaviour
Given following file
test.rb
:When I execute command:
I see following:
What documentation says
(https://rubocop.readthedocs.io/en/latest/cops_lint/#lintambiguousblockassociation)
What is the problem
The documentation describes a different case than the cop. Given aforementioned code sample:
The cop message says that this line should be fixed in a following way:
Whereas documentation suggests that it should rather be fixed in following way:
Which is syntactically and semantically different.
Obviously, both suggested resolutions are correct in some cases and incorrect in others. Applying any of them results with
1 file inspected, no offenses detected
. Nevertheless, this discrepancy is somewhat confusing.Suggestion 1
IMHO cop documentation should illustrate both "good" resolutions, like in following:
I have no suggestion how to improve the cop message. It should be succinct, so perhaps the current one is good enough.
Suggestion 2
Given the fact that this cop often reports a false positive for a popular RSpec idiom:
Documentation could propose to disable this cop for spec files (see #4222).
RuboCop version
0.76.0 (using Parser 2.6.5.0, running on ruby 2.6.3 x86_64-darwin17)
The text was updated successfully, but these errors were encountered: