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);
|
|
|
|
----
|