rspec/rules/S3223/rule.adoc

28 lines
560 B
Plaintext
Raw Normal View History

The use of a string literal in a boolean test is likely an error since the test will always evaluate to true (i.e. the string is a non-0 value).
== Noncompliant Code Example
----
if ("foo") { // Noncompliant - always evaluates to true
...
} else {
// unreachable, never executed
}
----
== See
2021-10-28 10:07:16 +02:00
* https://cwe.mitre.org/data/definitions/571.html[MITRE, CWE-571] - Expression is Always True
2022-01-25 18:36:46 +01:00
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]