forked from checkstyle/checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue checkstyle#10924: Update SingleSpaceSeparatorCheck to use code …
…points
- Loading branch information
Showing
6 changed files
with
178 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...le/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorCommentsWithEmoji.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
SingleSpaceSeparator | ||
validateComments = true | ||
*/ | ||
|
||
package com.puppycrawl.tools.checkstyle.checks.whitespace.singlespaceseparator; | ||
|
||
public class InputSingleSpaceSeparatorCommentsWithEmoji { | ||
|
||
|
||
String s1 = "🧐😉 assa "; // ok | ||
String s2 = "🧐😉" + " " + "assa "; // ok | ||
String s3 = "🧐" + "🎄 "; // ok | ||
String s4 | ||
= "da🎄"; // ok | ||
private void foo(String s) { | ||
if (s.equals("🤩🎄") ){ // ok | ||
foo(s); | ||
} | ||
} | ||
|
||
/* ok */ /*🧐*/ String s = "🎄😉"; | ||
String /* 🧐 ok */ st = "🎄 assa"; // 2 violations | ||
String str = "🤩🎄"; // violation 'Use a single space to separate non-whitespace characters' | ||
; String j = ""; // violation 'Use a single space to separate non-whitespace characters' | ||
/** | ||
* ok | ||
*/ | ||
void foo2() { | ||
/*🧐 🧐 🧐 🧐*/ /* ok */ | ||
String s = "🧐 🧐"; | ||
} // violation 'Use a single space to separate non-whitespace characters' | ||
|
||
private void foo3 (String s) { // ok | ||
// violation above 'Use a single space to separate non-whitespace characters' | ||
if (s.substring(0).equals("da🎄")) { // ok | ||
// violation above 'Use a single space to separate non-whitespace characters' | ||
/*🧐 🧐 🧐*/ /* comment */ if ("🧐".isEmpty()){ // ok | ||
// violation above 'Use a single space to separate non-whitespace characters' | ||
} | ||
} | ||
|
||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...checkstyle/checks/whitespace/singlespaceseparator/InputSingleSpaceSeparatorWithEmoji.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
SingleSpaceSeparator | ||
validateComments = (default)false | ||
*/ | ||
|
||
package com.puppycrawl.tools.checkstyle.checks.whitespace.singlespaceseparator; | ||
|
||
public class InputSingleSpaceSeparatorWithEmoji { | ||
|
||
String s1 = "🧐😉 assa "; // ok | ||
String s2 = "🧐😉" + " " + "assa "; // ok | ||
String s3 = "🧐" + "🎄 "; // violation 'Use a single space to separate non-whitespace characters' | ||
String s4 | ||
= "da🎄"; // violation 'Use a single space to separate non-whitespace characters' | ||
private void foo(String s) { | ||
if (s.equals("🤩🎄") ){ // violation 'Use a single space to separate non-whitespace characters' | ||
foo(s); | ||
} | ||
} | ||
|
||
/* ok */ /*🧐*/ String s = "🎄😉"; | ||
String /* 🧐 block comment ok */ st = "🎄 assa"; | ||
// violation above 'Use a single space to separate non-whitespace characters' | ||
String str = "🤩🎄"; // Multiple whitespaces before comment | ||
; String j = ""; // violation 'Use a single space to separate non-whitespace characters' | ||
/** | ||
* ok | ||
*/ | ||
void foo2() { | ||
/* ok */ | ||
String s = "🧐 🧐"; // violation 'Use a single space to separate non-whitespace characters' | ||
} // ok | ||
|
||
private void foo3 (String s) { // 3 violations | ||
if (s.substring(0).equals("da🎄") ) { // 2 violations | ||
if ("🧐". // violation 'Use a single space to separate non-whitespace characters' | ||
isEmpty()){ | ||
|
||
} | ||
} | ||
|
||
} | ||
} |