Codacy: "Unnecessary parentheses around expression" warnings are too strict
See original GitHub issueRecently, Codacy starts complaining about “unnecessary parentheses” used in boolean expressions, Things like e.g. shown in following screenshot:
The underlying rule is Checkstyle_UnnecessaryParentheses
:
I agree that this is in general a useful rules, and I also agree that in the given examples the parenthesis shall be removed.
But for boolean expressions like the above I find the parentheses extremely helpful for understanding the logic behind them - although they are maybe not be strictly necessary because of operator precedence?
Would it be ok to “lighten” that rule?
And on a second note: if yes, how can I do that??? AFAICS Codacy uses our checkstyle rule file, but Jenkins does not complain about these things…
A third thing: I miss edit rights for Codacy, it always tells me I have to be “admin” to do something. Is there any way to change this?
Issue Analytics
- State:
- Created 2 years ago
- Comments:19 (19 by maintainers)
Top GitHub Comments
In PR #11425 I see many other examples of “unnecessary parenthesis” which I frankly find quite useful for code readability.
What about just removing this rule completely from checkstyle?
So it’s the same perception that I have. Then lets remove the entry for
UnnecessaryParentheses
.I would leave the Checkstyle configuration on CI (for PR) as it is now. That means to not fail on severity" =“info”.