Skip to content

Commit 974c9aa

Browse files
authored
Enable BooleanNegation checkstyle rule always (#68677)
Having fixed all the uses of `!` for boolean negation, now enforce the `== false` style via Checkstyle all the time.
1 parent 44ea9f8 commit 974c9aa

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

buildSrc/src/main/resources/checkstyle.xml

+9-9
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,17 @@
124124
</module>
125125

126126
<!-- Forbid using '!' for logical negations in favour of checking against 'false' explicitly. -->
127-
<!-- This is disabled for now because there are many violations, hence the rule is reporting at the "warning" severity. -->
128-
<!--
127+
<!-- This is only reported in the IDE for now because there are many violations -->
129128
<module name="DescendantToken">
130-
<property name="id" value="BooleanNegation" />
131-
<property name="tokens" value="EXPR"/>
132-
<property name="limitedTokens" value="LNOT"/>
133-
<property name="maximumNumber" value="0"/>
134-
<property name="maximumDepth" value="1"/>
135-
<message key="descendant.token.max" value="Do not negate boolean expressions with '!', but check explicitly with '== false' as it is more explicit"/>
129+
<property name="id" value="BooleanNegation" />
130+
<property name="tokens" value="EXPR"/>
131+
<property name="limitedTokens" value="LNOT"/>
132+
<property name="maximumNumber" value="0"/>
133+
<property name="maximumDepth" value="2"/>
134+
<message
135+
key="descendant.token.max"
136+
value="Do not negate boolean expressions with '!', but check explicitly with '== false' as it is more explicit"/>
136137
</module>
137-
-->
138138

139139
</module>
140140
</module>

buildSrc/src/main/resources/checkstyle_ide_fragment.xml

-12
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@
88
<!-- Checkstyle config by the `:configureIdeCheckstyle` task. -->
99

1010
<module name="IdeFragment">
11-
<!-- Forbid using '!' for logical negations in favour of checking against 'false' explicitly. -->
12-
<!-- This is only reported in the IDE for now because there are many violations -->
13-
<module name="DescendantToken">
14-
<property name="id" value="BooleanNegation" />
15-
<property name="tokens" value="EXPR"/>
16-
<property name="limitedTokens" value="LNOT"/>
17-
<property name="maximumNumber" value="0"/>
18-
<property name="maximumDepth" value="2"/>
19-
<message
20-
key="descendant.token.max"
21-
value="Do not negate boolean expressions with '!', but check explicitly with '== false' as it is more explicit"/>
22-
</module>
2311

2412
<!-- See CONTRIBUTING.md for our guidelines on Javadoc -->
2513

0 commit comments

Comments
 (0)