2020-12-21 15:38:52 +01:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
if (booleanMethod() || false) { /* ... */ }
|
|
|
|
doSomething(!false);
|
|
|
|
|
|
|
|
booleanVariable = if (booleanMethod()) true else false;
|
|
|
|
booleanVariable = if (booleanMethod()) true else exp;
|
|
|
|
booleanVariable = if (booleanMethod()) false else exp;
|
|
|
|
booleanVariable = if (booleanMethod()) exp else true;
|
|
|
|
booleanVariable = if (booleanMethod()) exp else false;
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
if (booleanMethod()) { /* ... */ }
|
|
|
|
doSomething(true);
|
|
|
|
|
|
|
|
booleanVariable = booleanMethod();
|
|
|
|
booleanVariable = booleanMethod() || exp;
|
|
|
|
booleanVariable = !booleanMethod() && exp;
|
|
|
|
booleanVariable = !booleanMethod() || exp;
|
|
|
|
booleanVariable = booleanMethod() && exp;
|
|
|
|
----
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|