42 lines
804 B
Plaintext
42 lines
804 B
Plaintext
== Why is this an issue?
|
|
|
|
Boolean literals should be avoided in comparison expressions ``++==++`` and ``++!=++`` to improve code readability.
|
|
|
|
This rule also reports on redundant boolean operations.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
let someValue = "0";
|
|
// ...
|
|
|
|
if (someValue == true) { /* ... */ }
|
|
if (someBooleanValue != true) { /* ... */ }
|
|
doSomething(!false);
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
if (someValue && someValue != "0") { /* ... */ }
|
|
if (!someBooleanValue) { /* ... */ }
|
|
doSomething(true);
|
|
----
|
|
|
|
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[]
|