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
report an offense on the third line, suggesting a change to _, d, (_, e,) = a
autocorrect the third line to _, d, (_, e,) = a
Actual behavior
RuboCop reports:
foo.rb:2:7: C: Do not use trailing _s in parallel assignment. Prefer _, b, = a.
_, b, (_, c,) = a
^^^^^^^^
foo.rb:3:7: C: Do not use trailing _s in parallel assignment. Prefer _, d, = a.
_, d, (_, e, _) = a
^^^^^^^^^^
For complex destructuring assignments, Style/TrailingUnderscoreVariable gives false positives and performs the wrong autocorrect.
Expected behavior
Given the following code:
I expect RuboCop to:
_, d, (_, e,) = a
_, d, (_, e,) = a
Actual behavior
RuboCop reports:
RuboCop autocorrects the code to:
Steps to reproduce the problem
Given a file
foo.rb
with:rubocop foo.rb
to show the false positiverubocop -a foo.rb
to show the broken autocorrectRuboCop version
Include the output of
rubocop -V
. Here's an example:The text was updated successfully, but these errors were encountered: