Skip to content

Commit

Permalink
Issue checkstyle#13213: Remove //ok comments from whitespacearound
Browse files Browse the repository at this point in the history
  • Loading branch information
sumiyak96 authored and romani committed Dec 20, 2024
1 parent 88825cd commit 608d4a5
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 42 deletions.
22 changes: 0 additions & 22 deletions config/checkstyle-input-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1689,28 +1689,6 @@
files="checks[\\/]whitespace[\\/]whitespaceafter[\\/]InputWhitespaceAfterWithEmoji.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespaceafter[\\/]InputWhitespaceAfterWithEmoji.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAround1.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAround3.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAroundAfterEmoji.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAroundAfterEmoji.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAroundCatch.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAroundKeywordsAndOperators.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAroundKeywordsAndOperators.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAroundKeywordsAndOperators.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAroundKeywordsAndOperators.java"/>
<suppress id="UnnecessaryOkComment"
files="checks[\\/]whitespace[\\/]whitespacearound[\\/]InputWhitespaceAroundKeywordsAndOperators.java"/>
<suppress id="UnnecessaryOkComment"
files="filters[\\/]suppressioncommentfilter[\\/]InputSuppressionCommentFilter10.java"/>
<suppress id="UnnecessaryOkComment"
files="filters[\\/]suppressionxpathsinglefilter[\\/]InputSuppressionXpathSingleFilterNullViolation.java"/>
<suppress id="UnnecessaryOkComment"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ public void testKeywordsAndOperators()
"140:19: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "/"),
"141:18: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "/"),
"141:18: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "/"),
"169:9: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "assert"),
"172:20: " + getCheckMessage(MSG_WS_NOT_PRECEDED, ":"),
"172:20: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, ":"),
"278:13: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "}"),
"307:24: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "+"),
"307:24: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "+"),
"307:28: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "+"),
"307:28: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "+"),
"167:9: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "assert"),
"170:20: " + getCheckMessage(MSG_WS_NOT_PRECEDED, ":"),
"170:20: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, ":"),
"276:13: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "}"),
"305:24: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "+"),
"305:24: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "+"),
"305:28: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "+"),
"305:28: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "+"),
};
verifyWithInlineConfigParser(
getPath("InputWhitespaceAroundKeywordsAndOperators.java"), expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound;

@SuppressWarnings({"this", "that"})
public class InputWhitespaceAround1 // ok
public class InputWhitespaceAround1
{
protected InputWhitespaceAround1 ( int i )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound;

@SuppressWarnings({"this", "that"})
public class InputWhitespaceAround3 // ok
public class InputWhitespaceAround3
{
protected InputWhitespaceAround3 ( int i )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound;

public class InputWhitespaceAroundAfterEmoji {
String a = "🎄❤️😂" + "🎅🔥😊🎁"; // ok
String a = "🎄❤️😂" + "🎅🔥😊🎁";
String b = "🎄❤️😂"+ "🎅🔥😊🎁"; // violation ''\+' is not preceded with whitespace'
String c = "🎄❤️😂" +"🎅🔥😊🎁"; // violation ''\+' is not followed by whitespace'
String d = "🎄❤️😂"+"🎅🔥😊🎁"; // 2 violations
String e = "🎄" + "❤" + "️😂" + "🎅" + "🔥" + "😊" + "🎁"; // ok
String e = "🎄" + "❤" + "️😂" + "🎅" + "🔥" + "😊" + "🎁";
String f = "🎄"+"❤"+"️😂"+"🎅"+"🔥"+"😊"+"🎁"; // 12 violations
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound;

public class InputWhitespaceAroundCatch { // ok
public class InputWhitespaceAroundCatch {
public int case1(int i) {
int k = 1;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ private int nonVoid()
}
else
{
return 2; // this is ok
return 2;
}
}

/** test casts **/
private void testCasts()
{
Object o = (Object) new Object(); // ok
Object o = (Object) new Object();
o = (Object)o;
o = ( Object ) o; // ok
o = ( Object ) o;
o = (Object)
o; // ok
o;
}

/** test questions **/
Expand Down Expand Up @@ -156,10 +156,8 @@ private void divTest()
/** assert statement test */
public void assertTest()
{
// OK
assert true;

// OK
assert true : "Whups";

// evil colons, should be OK
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.puppycrawl.tools.checkstyle.filters.suppressioncommentfilter;

class InputSuppressionCommentFilter10 {
final static int logger = 50; // OK
final static int logger = 50;
//CHECKSTYLE:OFF
final static int logMYSELF = 10; // violation without filter
//CHECKSTYLE:ON
Expand Down

0 comments on commit 608d4a5

Please sign in to comment.