Skip to content

Commit 2d88243

Browse files
committed
[Checkstyle] Fix suppression comments not working properly
1 parent 8784ee2 commit 2d88243

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

.config/checkstyle/checkstyle.xml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@
4343
<property name="checks" value="MagicNumberCheck"/>
4444
<property name="files" value="[\\/]test[\\/].*\.java$"/>
4545
</module>
46+
47+
<!-- Suppressions -->
4648
<module name="SuppressWarningsFilter"/>
49+
<!-- https://github.com/checkstyle/checkstyle/issues/7287 -->
50+
<module name="SuppressWithPlainTextCommentFilter">
51+
<property name="offCommentFormat" value="// CHECKSTYLE\:OFF ([\w\|]+)"/>
52+
<property name="onCommentFormat" value="// CHECKSTYLE\:ON ([\w\|]+)"/>
53+
<property name="checkFormat" value="$1"/>
54+
</module>
4755

4856
<module name="TreeWalker">
4957
<!-- Checks - sorted alphabetically -->
@@ -131,11 +139,5 @@
131139
<property name="tokens"
132140
value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LCURLY,LE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND"/>
133141
</module>
134-
135-
<!-- Filter -->
136-
<module name="SuppressionCommentFilter">
137-
<property name="offCommentFormat" value="\s*CHECKSTYLE:OFF\s*[^\s]{1,}"/>
138-
<property name="onCommentFormat" value="\s*CHECKSTYLE:ON"/>
139-
</module>
140142
</module>
141143
</module>

0 commit comments

Comments
 (0)