This rule raises an issue when a name listed in the ``++__all__++`` property of a module has not been defined.

== Why is this an issue?

The ``++__all__++`` property of a module is used to define the list of names that will be imported when performing a wildcard import of this module, i.e. when ``++from mymodule import *++`` is used.

In the following example:

[source,python]
----
# mymodule.py

def foo(): ...
def bar(): ...

__all__ = ["foo"]
----

Executing ``++from mymodule import *++`` from a different module will only import `foo`.

This list can only reference defined names, otherwise an ``++AttributeError++`` will be raised when the module is imported.

=== Code examples

==== Noncompliant code example

[source,python]
----
from mymodule import my_func

__all__ = ["unknown_func"]  # Noncompliant: "unknown_func" is undefined
----


==== Compliant solution

[source,python]
----
from mymodule import my_func

__all__ = ["my_func"]
----


== Resources

=== Documentation

* 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

Change or remove this string; "XX" is not defined.


=== Highlighting

* Primary: The string with an undefined name.
* Secondary: the variable assignment if a variable is used.
 message: 'Assigned here.'


'''
== Comments And Links
(visible only on this page)

=== relates to: S2823

=== relates to: S3827

endif::env-github,rspecator-view[]
