2021-01-27 13:42:22 +01:00
|
|
|
Boolean literals should be avoided in comparison expressions ``++==++`` and ``++!=++`` to improve code readability.
|
2021-02-02 15:02:10 +01:00
|
|
|
|
2020-12-21 15:38:52 +01:00
|
|
|
This rule also reports on redundant boolean operations.
|
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
let someValue = "0";
|
|
|
|
// ...
|
|
|
|
|
|
|
|
if (someValue == true) { /* ... */ }
|
|
|
|
if (someBooleanValue != true) { /* ... */ }
|
|
|
|
doSomething(!false);
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
if (someValue && someValue != "0") { /* ... */ }
|
|
|
|
if (!someBooleanValue) { /* ... */ }
|
|
|
|
doSomething(true);
|
|
|
|
----
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
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[]
|