47 lines
1.0 KiB
Plaintext
47 lines
1.0 KiB
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,kotlin]
|
|
----
|
|
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
|
|
|
|
[source,kotlin]
|
|
----
|
|
if (booleanMethod()) { /* ... */ }
|
|
doSomething(true);
|
|
|
|
booleanVariable = booleanMethod();
|
|
booleanVariable = booleanMethod() || exp;
|
|
booleanVariable = !booleanMethod() && exp;
|
|
booleanVariable = !booleanMethod() || exp;
|
|
booleanVariable = booleanMethod() && exp;
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|