This is a request for new cop based on @bbatsov's comment here.
The cop should check for explicit parens when operators with varying precedence are used in a statement.
# bad
a && b || c
10 + 20 * 3
# good
(a && b) || c
10 + (20 * 3)
NA
We need to decide if the cop should consider all operators or only commonly used ones.
Well, I have to say I love the idea! 馃槈
Hi @bbatsov, I have made a PR for this feature. There is one issue I can fix in it.
The test case to fix a ** b * c / d % e + f - g << h >> i & j | k ^ l fails. Somehow the cop exercises the correction method only once.
It would be nice to have this depend somehow on the complexity of the expression. But then again, I think a ** b * c / d % e + f - g << h >> i & j | k ^ l would be equally hard to comprehend with parentheses.
Most helpful comment
Well, I have to say I love the idea! 馃槈