30 lines
619 B
Plaintext
Raw Normal View History

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
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);
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::rspecator-view[]