Skip to content

Commit

Permalink
Fix a false positive for bad-dunder-name when there is a user-def…
Browse files Browse the repository at this point in the history
…ined ``__index__`` method.

Closes pylint-dev#8613
  • Loading branch information
mbyrnepr2 committed Apr 24, 2023
1 parent a83137d commit 94cd2e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/8613.false_positive
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix a false positive for ``bad-dunder-name`` when there is a user-defined ``__index__`` method.

Closes #8613
1 change: 1 addition & 0 deletions pylint/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def _get_pylint_home() -> str:
"__getnewargs_ex__",
"__getnewargs__",
"__getstate__",
"__index__",
"__setstate__",
"__reduce__",
"__reduce_ex__",
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/ext/bad_dunder/bad_dunder_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def __private_method(self):
def __doc__(self):
return "Docstring"

def __index__(self):
return 1


def __increase_me__(val):
return val + 1

0 comments on commit 94cd2e3

Please sign in to comment.