Skip to content

Commit

Permalink
[doc] Update unnecessary-pass description and examples to be more s…
Browse files Browse the repository at this point in the history
…pecific (pylint-dev#8877)
  • Loading branch information
mbyrnepr2 committed Jul 25, 2023
1 parent cc67b33 commit fd29367
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/data/messages/u/unnecessary-pass/bad.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Foo:
"""Foo docstring."""
class DataEntryError(Exception):
"""This exception is raised when a user has provided incorrect data."""

pass # [unnecessary-pass]
4 changes: 2 additions & 2 deletions doc/data/messages/u/unnecessary-pass/good.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
class Foo:
"""Foo docstring."""
class DataEntryError(Exception):
"""This exception is raised when a user has provided incorrect data."""
3 changes: 2 additions & 1 deletion doc/user_guide/checkers/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ Basic checker Messages
disable it if you're using those strings as documentation, instead of
comments.
:unnecessary-pass (W0107): *Unnecessary pass statement*
Used when a "pass" statement that can be avoided is encountered.
Used when a "pass" statement can be removed without affecting the behaviour
of the code.
:unreachable (W0101): *Unreachable code*
Used when there is some code behind a "return" or "raise" statement, which
will never be accessed.
Expand Down
3 changes: 2 additions & 1 deletion pylint/checkers/base/pass_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class PassChecker(_BasicChecker):
"W0107": (
"Unnecessary pass statement",
"unnecessary-pass",
'Used when a "pass" statement that can be avoided is encountered.',
'Used when a "pass" statement can be removed without affecting '
"the behaviour of the code.",
)
}

Expand Down

0 comments on commit fd29367

Please sign in to comment.