Skip to content

Commit

Permalink
Add documentation for emitted messages (#7936)
Browse files Browse the repository at this point in the history
* Add doc for import-error
* Add doc for disallowed-name
* Add doc for else-if-used
* Add doc for import-self

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
  • Loading branch information
zenlyj and Pierre-Sassoulas committed Dec 14, 2022
1 parent c61bc76 commit d042f72
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 8 deletions.
2 changes: 2 additions & 0 deletions doc/data/messages/d/disallowed-name/bad.py
@@ -0,0 +1,2 @@
def foo(): # [disallowed-name]
pass
1 change: 0 additions & 1 deletion doc/data/messages/d/disallowed-name/details.rst

This file was deleted.

3 changes: 2 additions & 1 deletion doc/data/messages/d/disallowed-name/good.py
@@ -1 +1,2 @@
# This is a placeholder for correct code for this message.
def something_meaningful():
pass
7 changes: 7 additions & 0 deletions doc/data/messages/e/else-if-used/bad.py
@@ -0,0 +1,7 @@
if input():
pass
else:
if len(input()) >= 10: # [else-if-used]
pass
else:
pass
1 change: 0 additions & 1 deletion doc/data/messages/e/else-if-used/details.rst

This file was deleted.

7 changes: 6 additions & 1 deletion doc/data/messages/e/else-if-used/good.py
@@ -1 +1,6 @@
# This is a placeholder for correct code for this message.
if input():
pass
elif len(input()) >= 10:
pass
else:
pass
2 changes: 2 additions & 0 deletions doc/data/messages/e/else-if-used/pylintrc
@@ -0,0 +1,2 @@
[MAIN]
load-plugins=pylint.extensions.check_elif
1 change: 1 addition & 0 deletions doc/data/messages/i/import-error/bad.py
@@ -0,0 +1 @@
from patlib import Path # [import-error]
4 changes: 3 additions & 1 deletion doc/data/messages/i/import-error/details.rst
@@ -1 +1,3 @@
You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
This can happen if you're importing a package that is not installed in your environment, or if you made a typo.

The solution is to install the package via pip/setup.py/wheel or fix the typo.
2 changes: 1 addition & 1 deletion doc/data/messages/i/import-error/good.py
@@ -1 +1 @@
# This is a placeholder for correct code for this message.
from pathlib import Path
5 changes: 5 additions & 0 deletions doc/data/messages/i/import-self/bad.py
@@ -0,0 +1,5 @@
from bad import a_function # [import-self]


def a_function():
pass
1 change: 0 additions & 1 deletion doc/data/messages/i/import-self/details.rst

This file was deleted.

3 changes: 2 additions & 1 deletion doc/data/messages/i/import-self/good.py
@@ -1 +1,2 @@
# This is a placeholder for correct code for this message.
def a_function():
pass

0 comments on commit d042f72

Please sign in to comment.