rspec/rules/S1128/python/rule.adoc

37 lines
646 B
Plaintext
Raw Normal View History

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[]
'''