-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Description
This is my code. BadClass is bad, but I have to live with it:
from typing import override
class BadClass:
def fun(self, DaTa: int) -> None: ... # noqa: N803
class MyClass(BadClass):
@override
def fun(self, DaTa: int) -> None: ...ruff --isolated check --select=N803 bug.py (v0.9.4) gives:
>ruff --isolated check --select=N803 bug.py
bug.py:10:19: N803 Argument name `DaTa` should be lowercase
|
8 | class MyClass(BadClass):
9 | @override
10 | def fun(self, DaTa: int) -> None: ...
| ^^^^^^^^^ N803
|
However, I'd argue I have to name that argument that way - otherwise, pyright tells me:
c:\Git\project\bug.py
c:\Git\project\bug.py:10:9 - error: Method "fun" overrides class "BadClass" in an incompatible manner
Parameter 2 name mismatch: base parameter is named "DaTa", override parameter is named "data" (reportIncompatibleMethodOverride)
1 error, 0 warnings, 0 informations
So I'd argue that N803 should ignore functions with @override (as well as their @overloads!).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule