I have read check documentation: https://checkstyle.sourceforge.io/checks/sizes/linelength.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
From: https://google.github.io/styleguide/javaguide.html#s4.4-column-limit
Command lines in a comment that may be copied-and-pasted into a shell are exempt from the column limit.
Code:
class Test {
// > 100 characters but no violation expected
// Run with: ./gradlew build --info --stacktrace --debug --max-workers=8 --build-cache --project-cache-dir=.cache/longpath
}
Cli:
$ java -jar checkstyle-10.26.1-all.jar -c google_checks.xml Test.java
Starting audit...
[WARN] /mnt/c/Iron/NJU/Master/Research/CodeStyleResearch/src/BenchmarkMaker/config/Test.java:3: Line is longer than 100 characters (found 122). [LineLength]
Audit done.
Formatter:
$ java -jar google-java-format-1.28.0-all-deps.jar Test.java > FormattedCode.java
$ diff -Naru Test.java FormattedCode.java
--- Test.java 2025-09-02 00:02:25.259920500 +0800
+++ FormattedCode.java 2025-09-02 00:02:32.571719100 +0800
@@ -1,4 +1,5 @@
class Test {
-// > 100 characters but no violation expected
-// Run with: ./gradlew build --info --stacktrace --debug --max-workers=8 --build-cache --project-cache-dir=.cache/longpath
+ // > 100 characters but no violation expected
+ // Run with: ./gradlew build --info --stacktrace --debug --max-workers=8 --build-cache
+ // --project-cache-dir=.cache/longpath
}
We understand it is difficult to reliably detect whether a comment contains a shell command. In the Checkstyle cover page for GoogleStyle
, it is already mentioned that support is only partial. Currently, the note says:
We can detect URL with protocol type as http://, https:// etc.
JSNI is not supported, see reason at: #14938.
To suppress this rule for longer identifiers, please use SuppressWithNearbyTextFilter. Check out Suppressions section to learn how to use this suppression.
However, command lines do not seem to be mentioned, despite being explicitly exempt in the style guide.
I have read check documentation: https://checkstyle.sourceforge.io/checks/sizes/linelength.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
From: https://google.github.io/styleguide/javaguide.html#s4.4-column-limit
Code:
Cli:
$ java -jar checkstyle-10.26.1-all.jar -c google_checks.xml Test.java Starting audit... [WARN] /mnt/c/Iron/NJU/Master/Research/CodeStyleResearch/src/BenchmarkMaker/config/Test.java:3: Line is longer than 100 characters (found 122). [LineLength] Audit done.Formatter:
We understand it is difficult to reliably detect whether a comment contains a shell command. In the Checkstyle cover page for GoogleStyle
, it is already mentioned that support is only partial. Currently, the note says:
However, command lines do not seem to be mentioned, despite being explicitly exempt in the style guide.