With a method like:
def foo
yield ({
a: 6,
b: 7,
})
end
Runningrubocop -a autocorrects this to:
def foo
yield {
a: 6,
b: 7,
}
end
And gives this output:
app/test.rb:4:9: E: Lint/Syntax: unexpected token tLCURLY
(Using Ruby 2.5 parser; configure using TargetRubyVersion parameter, under AllCops)
yield {
^
app/test.rb:4:9: C: [Corrected] Style/RedundantParentheses: Don't use parentheses around a literal.
yield ({ ...
^^
When running this auto-corrected file, I get a syntax error:
app/test.rb:4: syntax error, unexpected '{'
yield {
^
I believe the Style/RedundantParentheses cop should not consider parentheses in this situation to be redundant
$ rubocop -V
0.86.0 (using Parser 2.7.1.4, rubocop-ast 0.0.3, running on ruby 2.5.1 x86_64-darwin18)
I will look into a fix for this
Most helpful comment
I will look into a fix for this