You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The message is (for the code using Module.new {}):
Parenthesize the param Module.new {} to make sure that the block
will be associated with the Module.new method call.
But this sounds like spreading fear and doubt when the Ruby parser has no such concepts :) {} always binds tightly to the call right next to it.
This block {} will never go to using, unless it's rewritten as do ... end.
Expected behavior
A better message, clarifying the true purpose of the cop, which I guess is to differentiate empty Hash literals and blocks.
Maybe
core/module/using_spec.rb:92:9: W: Lint/AmbiguousBlockAssociation: Parenthesizetheparam
`Module.new{}` to clarify `{}` is a block passed to `Module.new` and not anemptyHashliteral.usingModule.new{}
^^^^^^^^^^^^^^^^^^^
However, I find using(Module.new {}) not so beautiful, but that might be subjective.
The message is (for the code
using Module.new {}
):But this sounds like spreading fear and doubt when the Ruby parser has no such concepts :)
{}
always binds tightly to the call right next to it.This block
{}
will never go to using, unless it's rewritten asdo ... end
.Expected behavior
A better message, clarifying the true purpose of the cop, which I guess is to differentiate empty Hash literals and blocks.
Maybe
However, I find
using(Module.new {})
not so beautiful, but that might be subjective.is likely a better fix.
Actual behavior
Steps to reproduce the problem
Run RuboCop on a file containing
RuboCop version
The text was updated successfully, but these errors were encountered: