-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violationshelp wantedContributions especially welcomeContributions especially welcome
Description
Summary
The fix for invalid-first-argument-name-for-method (N805) should be suppressed when the recommended parameter name is already taken by another variable used within that scope.
$ cat >n805.py <<'# EOF'
class C:
def f(this):
self = type(this).__name__
print(self, this.__sizeof__())
C().f()
# EOF
$ python n805.py
C 16
$ ruff --isolated check n805.py --select N805 --unsafe-fixes --fix
Found 1 error (1 fixed, 0 remaining).
$ cat n805.py
class C:
def f(self):
self = type(self).__name__
print(self, self.__sizeof__())
C().f()
$ python n805.py
C 42Version
ruff 0.11.12 (aee3af0 2025-05-29)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violationshelp wantedContributions especially welcomeContributions especially welcome