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
In Standard @sethherr noticed an undesired interaction between the safe autocorrections of Lint/ParenthesesAsGroupedExpression and Style/RedundantParentheses (both enabled-by-default): standardrb/standard#192
Expected behavior
Here's the starting code example:
do_something(foo)
Here's what happens when I run only Lint/ParenthesesAsGroupedExpression and Style/RedundantParentheses:
$ rubocop --only "Lint/ParenthesesAsGroupedExpression,Style/RedundantParentheses" foo.rb
Inspecting 1 file
W
Offenses:
foo.rb:1:13: W: Lint/ParenthesesAsGroupedExpression: (...) interpreted as grouped expression.
do_something (foo)
^
foo.rb:1:14: C: Style/RedundantParentheses: Don't use parentheses around a method call.
do_something (foo)
^^^^^
1 file inspected, 2 offenses detected
My expectation is the autocorrect would ultimately result in either do_something foo or do_something(foo)
Actual behavior
When running the same command with autocorrect, this is what we get:
$ be rubocop --only "Lint/ParenthesesAsGroupedExpression,Style/RedundantParentheses" -a foo.rb
Inspecting 1 file
W
Offenses:
foo.rb:1:13: W: [Corrected] Lint/ParenthesesAsGroupedExpression: (...) interpreted as grouped expression.
do_something (foo)
^
foo.rb:1:14: C: [Corrected] Style/RedundantParentheses: Don't use parentheses around a method call.
do_something (foo)
^^^^^
1 file inspected, 2 offenses detected, 2 offenses corrected
And now the result is definitely wrong:
$ cat foo.rb
do_somethingfoo
Steps to reproduce the problem
I hope the instructions above are a clear enough minimal reproduction
In Standard @sethherr noticed an undesired interaction between the safe autocorrections of
Lint/ParenthesesAsGroupedExpression
andStyle/RedundantParentheses
(both enabled-by-default): standardrb/standard#192Expected behavior
Here's the starting code example:
Here's what happens when I run only
Lint/ParenthesesAsGroupedExpression
andStyle/RedundantParentheses
:My expectation is the autocorrect would ultimately result in either
do_something foo
ordo_something(foo)
Actual behavior
When running the same command with autocorrect, this is what we get:
And now the result is definitely wrong:
Steps to reproduce the problem
I hope the instructions above are a clear enough minimal reproduction
RuboCop version
The text was updated successfully, but these errors were encountered: