-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Lint/AmbiguousBlockAssociation cites unambiguous lambda param #4189
Comments
…bda arguments This cop would register an offense for lambdas passed as an argument to a method, suggesting an awkward parentheses placement. This change fixes that.
@Drenmi thanks for fixing that! I missed that case... |
I got plain Rails scope like
|
@ivanovaleksey Are you using 0.48.1? |
@bbatsov, yes
|
Yeah, I'm seeing the same thing, on 0.48.1 for something like: scope :vat, -> { where(post_subtotal_type: 'vat') } |
@brandonweiss @bbatsov yes, there is a problem with lambda check. It's easily fixable. Should I create another PR to this issue? |
ラムダをパラメータにしたときにLint/AmbiguousBlockAssociationの違反と みなされる不具合を回避するため。 rubocop/rubocop#4189 masterにはmergeされているようだが、RubyGemsには来ていないのでそれまでは 個別に回避する。
When passing a lambda declaration as a method parameter, the new Lint/AmbiguousBlockAssociation cop forces unnecessary parentheses.
Example:
Note that the method does not generally require parentheses:
Expected behavior
I expect Lint/AmbiguousBlockAssociation to not cite lambdas passed as params like any other object.
Actual behavior
The new Lint/AmbiguousBlockAssociation cop creates a citation for lambdas passed as params like any other object.
Steps to reproduce the problem
Create file:
Run rubocop:
RuboCop version
The text was updated successfully, but these errors were encountered: