Files
openide/java/java-impl/resources/inspectionDescriptions/ThreeNegationsPerMethod.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

29 lines
845 B
HTML

<html>
<body>
Reports methods with three or more negations.
Such methods may be confusing.
<p><b>Example:</b></p>
<pre><code>
void doSmth(int a, int b, boolean flag1, boolean flag2) {
if (!flag && !flag2) {
if (a != b) {
doOther();
}
}
}
</code></pre>
<p>Without negations, the method becomes easier to understand:</p>
<pre><code>
void doSmth(int a, int b, boolean flag1, boolean flag2) {
if (flag1 || flag2 || a == b) return;
doOther();
}
</code></pre>
<!-- tooltip end -->
<p>Configure the inspection:</p>
<ul>
<li>Use the <b>Ignore negations in 'equals()' methods</b> option to disable the inspection within <code>equals()</code> methods.</li>
<li>Use the <b>Ignore negations in 'assert' statements</b> to disable the inspection within <code>assert</code> statements.</li>
</ul>
</body>
</html>