rspec/rules/S2823/python/rule.adoc

54 lines
859 B
Plaintext

== Why is this an issue?
``++__all__++`` is used to define the list of module's names that should be imported when ``++from package import *++`` is used. For that reason, it may only contain strings.
=== Noncompliant code example
[source,python]
----
class MyClass:
pass
__all__ = [
MyClass # Noncompliant
]
----
=== Compliant solution
[source,python]
----
class MyClass:
pass
__all__ = [
"MyClass"
]
----
== Resources
* https://docs.python.org/3/tutorial/modules.html#importing-from-a-package[Python documentation - Importing * From a Package]
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[]