45 lines
855 B
Plaintext
45 lines
855 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,python]
|
|
----
|
|
def func(a, b, compute):
|
|
i = a + b # Noncompliant; calculation result not used before value is overwritten
|
|
i = compute() # Noncompliant; the value is not used before leaving the function
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[source,python]
|
|
----
|
|
def func(a, b, compute):
|
|
i = a + b
|
|
i += compute()
|
|
return i
|
|
----
|
|
|
|
== Exceptions
|
|
|
|
This rule ignores initializations to -1, 0, 1, ``++None++``, ``++True++``, ``++False++`` and ``++""++``.
|
|
|
|
|
|
No issue will be raised on unpacked variables.
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|