
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
52 lines
1.0 KiB
Plaintext
52 lines
1.0 KiB
Plaintext
== Why is this an issue?
|
|
|
|
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()
|
|
return i
|
|
----
|
|
|
|
=== 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)
|
|
|
|
=== on 13 Nov 2019, 06:56:28 Alexandre Gigleux wrote:
|
|
\[~pierre-yves.nicolas] Rule S1854 is not raised for the "Noncompliant Code". Instead S1481 "Unused local variables should be removed" is raised.
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|