Skip to content

Commit

Permalink
Ignore explicit overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jul 25, 2023
1 parent 11dd457 commit ca52b63
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
13 changes: 4 additions & 9 deletions crates/ruff/resources/test/fixtures/flake8_builtins/A003.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,9 @@ def str(self) -> None:


class MyClass:
ImportError = 4
id: int
dir = "/"

def __init__(self):
self.float = 5 # is fine
self.id = 10
self.dir = "."

@override
def str(self):
pass

def int(self):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ use crate::rules::flake8_builtins::helpers::shadows_builtin;
///
/// Builtins can be marked as exceptions to this rule via the
/// [`flake8-builtins.builtins-ignorelist`] configuration option, or
/// converted to the appropriate dunder method.
/// converted to the appropriate dunder method. Methods decorated with
/// `@typing.override` or `@typing_extensions.override` are also
/// ignored.
///
/// ## Example
/// ```python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,13 @@ A003.py:40:9: A003 Class attribute `str` is shadowing a Python builtin
41 | ...
|

A003.py:52:9: A003 Class attribute `int` is shadowing a Python builtin
|
50 | pass
51 |
52 | def int(self):
| ^^^ A003
53 | pass
|


Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ A003.py:40:9: A003 Class attribute `str` is shadowing a Python builtin
41 | ...
|

A003.py:52:9: A003 Class attribute `int` is shadowing a Python builtin
|
50 | pass
51 |
52 | def int(self):
| ^^^ A003
53 | pass
|


0 comments on commit ca52b63

Please sign in to comment.