-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
approvedbugfalse negativeissues where check should place violations on code, but does notissues where check should place violations on code, but does notgoogle style
Milestone
Description
I have read check documentation: https://checkstyle.org/checks/coding/illegaltokentext.html
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
Code:
$ cat EscapedCodes.java
class EscapedCodes {
public void unicode() {
final String r0 = "\s";
final String r1 = "\u000b"; // Expected violation
final String r2 = "\u000c"; // OK
final String r3 = "\u001c"; // Expected violation
final String r4 = "\u001D"; // Expected violation
final String r5 = "\u001E"; // Expected violation
final String r6 = "\u001F"; // Expected violation
final String r7 = "\u1680"; // Expected violation
final String r8 = "\u2000"; // Expected violation
final String r9 = "\u200A"; // Expected violation
final String r10 = "\u2028"; // Expected violation
final String r12 = "\u2029"; // Expected violation
final String r13 = "\u202F"; // Expected violation
final String r14 = "\u205F"; // Expected violation
final String r15 = "\u3000"; // Expected violation
}
public void octal() {
final String r1 = "\040"; // Expected violation
final String r2 = "\011"; // ok
final String r3 = "\012"; // ok
}
}Cli:
$ java -jar checkstyle-10.26.1-all.jar -c google_checks.xml EscapedCodes.java
Starting audit...
[WARN] /mnt/5D92528E6B945467/test/testing/EscapedCodes.java:5:23: Consider using special escape sequence instead of octal value or Unicode escaped value. [IllegalTokenText]
[WARN] /mnt/5D92528E6B945467/test/testing/EscapedCodes.java:22:23: Consider using special escape sequence instead of octal value or Unicode escaped value. [IllegalTokenText]
[WARN] /mnt/5D92528E6B945467/test/testing/EscapedCodes.java:23:23: Consider using special escape sequence instead of octal value or Unicode escaped value. [IllegalTokenText]
Audit done.
https://en.wikipedia.org/wiki/Whitespace_character
For example, a space character (U+0020 SPACE, ASCII 32) represents blank space such as a word divider in a Western script.
The 040 part is the octal (base-8) representation of the ASCII code for the space character, which is decimal 32.
Metadata
Metadata
Assignees
Labels
approvedbugfalse negativeissues where check should place violations on code, but does notissues where check should place violations on code, but does notgoogle style