Skip to content
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

Unsafe auto-correct for Style/RedundantParentheses #9689

Closed
vlad-pisanov opened this issue Apr 9, 2021 · 0 comments · Fixed by #9709
Closed

Unsafe auto-correct for Style/RedundantParentheses #9689

vlad-pisanov opened this issue Apr 9, 2021 · 0 comments · Fixed by #9709
Assignees
Labels

Comments

@vlad-pisanov
Copy link

When auto-correcting a redundant parenthesis inside an array with assignments in it, the resulting code is invalid Ruby. e.g. consider:

[
 x = (
   1
 ),
 y = 2
]

Produces the invalid syntax:

[
  x =
    1
  ,
  y = 2
]

Expected behavior

Should either be marked unsafe, or autocorrect to:

[
 x = 1,
 y = 2
]

Steps to reproduce the problem

Auto-correct code above with Style/RedundantParenteses

RuboCop version

1.12.1 (using Parser 3.0.1.0, rubocop-ast 1.4.1, running on ruby 2.6.5 x86_64-darwin19)
@koic koic added the bug label Apr 9, 2021
@dvandersluis dvandersluis self-assigned this Apr 18, 2021
dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Apr 18, 2021
bbatsov pushed a commit that referenced this issue Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants