32 lines
415 B
Plaintext
32 lines
415 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
a = True;
|
||
|
if a: # Noncompliant
|
||
|
doSomething()
|
||
|
|
||
|
if b and a: # Noncompliant; "a" is always "True"
|
||
|
doSomething()
|
||
|
|
||
|
if c or not a: # Noncompliant; "not a" is always "False"
|
||
|
doSomething()
|
||
|
----
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
a = True;
|
||
|
if foo(a):
|
||
|
doSomething()
|
||
|
|
||
|
if b:
|
||
|
doSomething()
|
||
|
|
||
|
if c:
|
||
|
doSomething()
|
||
|
----
|
||
|
|
||
|
include::../see.adoc[]
|