Skip to content

Commit

Permalink
Issue #13213: Remove '//ok' comments from InputUnnecessaryParentheses…
Browse files Browse the repository at this point in the history
…IfStatement2
  • Loading branch information
CubeTures authored and romani committed Feb 28, 2024
1 parent 79c3683 commit bb97694
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 39 deletions.
26 changes: 0 additions & 26 deletions config/checkstyle-input-suppressions.xml
Expand Up @@ -173,32 +173,6 @@
files="checks[\\/]coding[\\/]requirethis[\\/]InputRequireThisValidateOnlyOverlappingFalse.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]requirethis[\\/]InputRequireThisValidateOnlyOverlappingTrue2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesIfStatement2.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]coding[\\/]unnecessaryparentheses[\\/]InputUnnecessaryParenthesesOperator.java"/>
<suppress id="UnnecessaryOkComment"
Expand Down
Expand Up @@ -19,21 +19,21 @@ void testShortCircuitOrIfStatement() {
boolean a = false;
boolean x = false, y = true, z = false;
boolean v = true, w = true, u = true;
boolean vy = x && y || (x || y || z) && v; // ok
if (a && !(v && w || (x || y) && z || u && x)) { // ok
boolean vy = x && y || (x || y || z) && v;
if (a && !(v && w || (x || y) && z || u && x)) {
}
if (a && !(v && w || x || y && z || u && x)) { // ok
if (a && !(v && w || x || y && z || u && x)) {
}
if (v ||
(u || x || y)) { // violation 'Unnecessary parentheses around expression'
}
if ((v || x) == // ok
if ((v || x) ==
(w || y)) {
}
if ((v || x) & // ok
if ((v || x) &
(w || y)) {
}
if (a && v || (w || z) && u || y) { // ok
if (a && v || (w || z) && u || y) {
}
if (a && x ||
(y || z) // violation 'Unnecessary parentheses around expression'
Expand All @@ -59,14 +59,14 @@ public void checkBooleanStatements() {
&& (a // violation 'Unnecessary parentheses around expression'
&& (b==c))) // violation 'Unnecessary parentheses around expression'
|| (a // violation 'Unnecessary parentheses around expression'
|| a!=(b<=c)) // ok
|| a!=(b<=c))
|| (a==(b!=d==(c==b) && a!=(b<=c)))) { // violation 'parentheses around expression'
// after '||'
return;
}

if (a==(b>=c && a==(c==d && d!=b)) // ok
&& a==(c<=d)) { // ok
if (a==(b>=c && a==(c==d && d!=b))
&& a==(c<=d)) {
return;
}

Expand All @@ -75,13 +75,13 @@ public void checkBooleanStatements() {
return;
}

if (a==(b==c) // ok
|| a!=(b<=c)) { // ok
if (a==(b==c)
|| a!=(b<=c)) {
return;
}

if ((b==0) == (c==d) // ok
&& (Integer.valueOf(d) instanceof Integer) == true) { // ok
if ((b==0) == (c==d)
&& (Integer.valueOf(d) instanceof Integer) == true) {
return;
}
}
Expand Down

0 comments on commit bb97694

Please sign in to comment.