47 lines
698 B
Plaintext
47 lines
698 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,python]
|
|
----
|
|
def f(b):
|
|
a = True
|
|
if a: # Noncompliant
|
|
do_something()
|
|
|
|
if a and b: # Noncompliant; "a" is always "True"
|
|
do_something()
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[source,python]
|
|
----
|
|
def f(b):
|
|
a = True
|
|
if foo(a):
|
|
do_something()
|
|
|
|
if b:
|
|
do_something()
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|