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
[Fix #7495] Documentation for Lint/AmbiguousBlockAssociation
cop is confusing
#8850
[Fix #7495] Documentation for Lint/AmbiguousBlockAssociation
cop is confusing
#8850
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good. I'd merge but there's a Changelog merge conflict, so might as well improve it and rebase 😆
@@ -15,6 +15,8 @@ module Lint | |||
# | |||
# # good | |||
# # With parentheses, there's no ambiguity. | |||
# some_method(a { |val| puts val }) | |||
# # or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about # or (different meaning):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done it : )
Also the offense message would be best with quotes, if you'd like to do that too... Parenthesize the param a { |val| puts val } to make sure that the block will be associated with the a method call.
# to
Parenthesize the param `a { |val| puts val }` to make sure that the block will be associated with the `a` method call. |
Add example on documentation for `Lint/AmbiguousBlockAssociation` to make clear the possible resolutions
9efbb04
to
ef85068
Compare
I search for this and seems like it already has quotes, there is somewhere who hasn't the quotes and I let pass? |
Oh, perfect. I got that message from the original issue only, didn't check. |
Thanks for the PR! 👍 |
Fixes: #7495
Add an example in the documentation for
Lint/AmbiguousBlockAssociation
to illustrate both good solutions for this cop.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself and generates the documentation.