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/IfUnlessModifier bad precedence detection #8282

Closed
marcandre opened this issue Jul 9, 2020 · 0 comments · Fixed by #8287
Closed

Style/IfUnlessModifier bad precedence detection #8282

marcandre opened this issue Jul 9, 2020 · 0 comments · Fixed by #8287

Comments

@marcandre
Copy link
Contributor

The cop Style/IfUnlessModifier tests for being part of an assignment to add parenthesis, but that is way too naive. Being part of just about any operator expression won't work:

foo || if bar
        baz
      end
# autocorrected to:
foo || baz if bar

See also: #8281

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

Successfully merging a pull request may close this issue.

1 participant