You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PS D:\CS\test> cat src/Test.java
record ColoredPoint(int p, int x, boolean c) { }
record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) { }
public class Test {
void test(Object obj) {
switch (obj) {
case ColoredPoint(int a, int b, _)
// comment 1
when (a >= b) :
// comment 2
{} break;
case ColoredPoint(int a, int b, _) when (b > 100) // comment 3
:
/* violation
*
*/
{}
// ok
break;
default : System.out.println("none"); // violation
}
switch (obj) {
case ColoredPoint(int a, int b, _)
// comment 1
when (a >= b)
// comment 2
-> {}
case ColoredPoint(int a, int b, _) when (b > 100) // comment 3
->
/* comment 4
*
*/
{}
// ok
default -> System.out.println("none");
};
}
}
PS D:\CS\test> cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="TreeWalker">
<module name="CommentsIndentation">
</module>
</module>
</module>
PS D:\CS\test> java -jar checkstyle-10.17.0-all.jar -c config.xml src/Test.java
Starting audit...
[ERROR] D:\CS\test\src\Test.java:8:20: Comment has incorrect indentation level 19, expected is 20, indentation should be the same level as line 9. [CommentsIndentation]
[ERROR] D:\CS\test\src\Test.java:10:18: Comment has incorrect indentation level 17, expected is 16, indentation should be the same level as line 11. [CommentsIndentation]
[ERROR] D:\CS\test\src\Test.java:14:22: Block comment has incorrect indentation level 21, expected is 12, indentation should be the same level as line 17. [CommentsIndentation]
[ERROR] D:\CS\test\src\Test.java:18:14: Comment has incorrect indentation level 13, expected is 12, indentation should be the same level as line 19. [CommentsIndentation]
[ERROR] D:\CS\test\src\Test.java:24:20: Comment has incorrect indentation level 19, expected is 20, indentation should be the same level as line 25. [CommentsIndentation]
[ERROR] D:\CS\test\src\Test.java:26:29: Comment has incorrect indentation level 28, expected is 20, indentation should be the same level as line 27. [CommentsIndentation]
[ERROR] D:\CS\test\src\Test.java:30:22: Block comment has incorrect indentation level 21, expected is 12, indentation should be the same level as line 33. [CommentsIndentation]
[ERROR] D:\CS\test\src\Test.java:34:14: Comment has incorrect indentation level 13, expected is 12, 12, indentation should be the same level as line 33, 35. [CommentsIndentation]
Audit done.
Checkstyle ends with 8 errors.
PS D:\CS\test>
We are ok here. This is working as intended.
The text was updated successfully, but these errors were encountered:
child of #14961
I have read check documentation: https://checkstyle.org/checks/misc/commentsindentation.html#CommentsIndentation
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
We are ok here. This is working as intended.
The text was updated successfully, but these errors were encountered: