summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulthep Nandakwang <julthep@nandakwang.com>2022-06-25 02:43:55 +0700
committerGitHub <noreply@github.com>2022-06-24 21:43:55 +0200
commit3d2eed69e2c6a7cfcf6807cc30a30de6a3e3c628 (patch)
tree5338139c38d0d5b4f46542fb2d80cb222d2d4e8d
parent163a50c01a0f77a70dd96fd0be08350d77abc58a (diff)
downloadpylint-git-3d2eed69e2c6a7cfcf6807cc30a30de6a3e3c628.tar.gz
Add documentation examples for `invalid-all-object` (#7023)
Co-authored-by: Vladyslav Krylasov <vladyslav.krylasov@gmail.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-rw-r--r--doc/data/messages/i/invalid-all-object/bad.py11
-rw-r--r--doc/data/messages/i/invalid-all-object/details.rst3
-rw-r--r--doc/data/messages/i/invalid-all-object/good.py8
-rw-r--r--doc/data/messages/i/invalid-all-object/related.rst1
4 files changed, 21 insertions, 2 deletions
diff --git a/doc/data/messages/i/invalid-all-object/bad.py b/doc/data/messages/i/invalid-all-object/bad.py
new file mode 100644
index 000000000..74cf738dc
--- /dev/null
+++ b/doc/data/messages/i/invalid-all-object/bad.py
@@ -0,0 +1,11 @@
+__all__ = (
+ None, # [invalid-all-object]
+ Fruit,
+ Worm,
+)
+
+class Fruit:
+ pass
+
+class Worm:
+ pass
diff --git a/doc/data/messages/i/invalid-all-object/details.rst b/doc/data/messages/i/invalid-all-object/details.rst
index ab8204529..db3d100aa 100644
--- a/doc/data/messages/i/invalid-all-object/details.rst
+++ b/doc/data/messages/i/invalid-all-object/details.rst
@@ -1 +1,2 @@
-You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
+From `The Python Language Reference – The import statement <https://docs.python.org/3/reference/simple_stmts.html#the-import-statement>`_:
+ "The `public names` defined by a module are determined by checking the module's namespace for a variable named ``__all__``; if defined, it must be a sequence of strings which are names defined or imported by that module."
diff --git a/doc/data/messages/i/invalid-all-object/good.py b/doc/data/messages/i/invalid-all-object/good.py
index c40beb573..db5879cf3 100644
--- a/doc/data/messages/i/invalid-all-object/good.py
+++ b/doc/data/messages/i/invalid-all-object/good.py
@@ -1 +1,7 @@
-# This is a placeholder for correct code for this message.
+__all__ = ['Fruit', 'Worm']
+
+class Fruit:
+ pass
+
+class Worm:
+ pass
diff --git a/doc/data/messages/i/invalid-all-object/related.rst b/doc/data/messages/i/invalid-all-object/related.rst
new file mode 100644
index 000000000..fff337eb9
--- /dev/null
+++ b/doc/data/messages/i/invalid-all-object/related.rst
@@ -0,0 +1 @@
+- `PEP 8 – Style Guide for Python Code <https://peps.python.org/pep-0008/#module-level-dunder-names>`_