Skip to content

Commit

Permalink
Avoid N802 violations for @overload methods
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanPlasse committed Sep 18, 2023
1 parent 0bfdb15 commit 92c22ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion crates/ruff/resources/test/fixtures/pep8_naming/N802.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ def testTest(self):
assert True


from typing import override
from typing import override, overload


@override
def BAD_FUNC():
pass

@overload
def BAD_FUNC():
pass
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ pub(crate) fn invalid_function_name(
return None;
}

// Ignore any functions that are explicitly `@override`. These are defined elsewhere,
// so if they're first-party, we'll flag them at the definition site.
if visibility::is_override(decorator_list, semantic) {
// Ignore any functions that are explicitly `@override` or `@overload`.
// These are defined elsewhere, so if they're first-party,
// we'll flag them at the definition site.
if visibility::is_override(decorator_list, semantic) || visibility::is_overload(decorator_list, semantic) {
return None;
}

Expand Down

0 comments on commit 92c22ec

Please sign in to comment.