Skip to content

Commit

Permalink
Add example useless-import-alias message documentation (#6151)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
  • Loading branch information
gunungpw and Pierre-Sassoulas authored Apr 3, 2022
1 parent 50ad118 commit a93602d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/data/messages/u/useless-import-alias/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import pandas as pandas # [useless-import-alias]
8 changes: 8 additions & 0 deletions doc/data/messages/u/useless-import-alias/details.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Known issue
-----------

If you prefer to use "from-as" to explicitly reexport in API (`from fruit import orange as orange`)
instead of using `__all__` this message will be a false positive.

If that's the case use `pylint: disable=useless-import-alias` before your imports in your API files.
`False positive 'useless-import-alias' error for mypy-compatible explicit re-exports #6006 <https://github.com/PyCQA/pylint/issues/6006>`_
1 change: 1 addition & 0 deletions doc/data/messages/u/useless-import-alias/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import pandas as pd
3 changes: 3 additions & 0 deletions doc/data/messages/u/useless-import-alias/related.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `PEP 8, Import Guideline <https://peps.python.org/pep-0008/#imports>`_
* `Pylint block-disable <https://pylint.pycqa.org/en/latest/user_guide/message-control.html#block-disables>`_
* `mypy --no-implicit-reexport <https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport>`_

0 comments on commit a93602d

Please sign in to comment.