40 lines
683 B
Plaintext
40 lines
683 B
Plaintext
This rule raises an issue when an imported name is unused.
|
|
|
|
== Why is this an issue?
|
|
|
|
Importing names and not using them can be a source of confusion and lead to maintainability issues.
|
|
|
|
Such imports should be removed.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,python,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
from mymodule import foo, bar, qix # Noncompliant: bar is unused
|
|
|
|
foo()
|
|
qix()
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,python,diff-id=1,diff-type=compliant]
|
|
----
|
|
from mymodule import foo, qix
|
|
|
|
foo()
|
|
qix()
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
|
|
endif::env-github,rspecator-view[]
|