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 88599dd
Show file tree
Hide file tree
Showing 2 changed files with 11 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,12 @@ 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 88599dd

Please sign in to comment.