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

Style/RedundantParentheses false negatives #8379

Closed
marcandre opened this issue Jul 21, 2020 · 4 comments · Fixed by #8903
Closed

Style/RedundantParentheses false negatives #8379

marcandre opened this issue Jul 21, 2020 · 4 comments · Fixed by #8903

Comments

@marcandre
Copy link
Contributor

It would be nice to refactor ( literal ) => literal, and "...#{( anything )}..." to "...#{ anything }..."

@fatkodima will probably handle this; let him know if you'd like to do it.

Noticed because of #8378

@fatkodima
Copy link
Contributor

There are so many cops that it is hard to remember all of them 😄 https://github.com/rubocop-hq/rubocop/blob/master/lib/rubocop/cop/style/redundant_parentheses.rb

It handles the first case and many more. Not sure if the second case is popular enough to worth implementing?

@marcandre
Copy link
Contributor Author

Good find.

It handles the first case

Clearly it does not as ("\#{user.name} \#{user.email}") * 5 was not autocorrected in #8378

Not sure if the second case is popular enough to worth implementing?

It might not be popular, but it can happen after auto-correcting (especially after #8378), so it would definitely be nice to enhance redundant_parentheses.

@marcandre marcandre changed the title Cop needed: redundant parenthesis Style/RedundantParentheses false negatives Jul 22, 2020
@fatkodima
Copy link
Contributor

Clearly it does not as ("#{user.name} #{user.email}") * 5 was not autocorrected in #8378

expect_correction runs only tested cop, so that cop hadn't a chance to run. I tested it separately and it detects and autocorrects that case.

@marcandre
Copy link
Contributor Author

🤦‍♂️my bad, sorry, you're right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants