-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
False-positive and broken autocorrect in Style/RedundantParentheses #2729
Comments
Thanks, that's definitely a bug. However, I'd still try to avoid those parentheses and instead put them around all arguments like this: |
Thinking about whether or not this could be called a false-positive I've decided that it must be, because even if we don't like the code it's certainly not redundant. We'd have to employ a new cop to say "this style is really ugly" IMO. |
I was a little hasty with the wording, sorry. @savef, your comment summarizes pretty well my opinion, too. The bug will be fixed soon but I leave the |
[Fix #2729] Fix hash bug in RedundantParentheses
The following code gives "don't use parentheses around a literal":
assert_equal ({ id: 1 }), some_method_call
The parentheses here are needed and when autocorrect removes them we're left with a syntax error.
Whether or not this is a false-positive might be up for debate, I imagine some would want to force this literal into a variable declaration because it is pretty ugly, but the autocorrect is definitely broken.
The text was updated successfully, but these errors were encountered: