rspec/rules/S2823/python/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
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.
2023-05-25 14:18:12 +02:00

61 lines
940 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)
=== Message
Replace this symbol with a string; "__all__" can only contain strings.
=== Highlighting
Primary: the wrong symbol in "__all__"
'''
== Comments And Links
(visible only on this page)
=== is related to: S5807
endif::env-github,rspecator-view[]