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
New Cop Idea: Explicit operator precedence #7849
Comments
Well, I have to say I love the idea! 😉 |
Fixes rubocop#7849 This cop checks if binary operators of different precedents are used without explicit use of parenthesis. ```ruby a && b || c a * b + c a ** b * c / d % e + f - g << h >> i & j | k ^ l (a && b) || c (a * b) + c (((((a**b) * c / d % e) + f - g) << h >> i) & j) | k ^ l ```
Hi @bbatsov, I have made a PR for this feature. There is one issue I can fix in it. |
It would be nice to have this depend somehow on the complexity of the expression. But then again, I think |
Is your feature request related to a problem? Please describe.
This is a request for new cop based on @bbatsov's comment here.
Describe the solution you'd like
The cop should check for explicit parens when operators with varying precedence are used in a statement.
Describe alternatives you've considered
NA
Additional context
We need to decide if the cop should consider all operators or only commonly used ones.
The text was updated successfully, but these errors were encountered: