diff --git a/crates/ruff/resources/test/fixtures/pep8_naming/N802.py b/crates/ruff/resources/test/fixtures/pep8_naming/N802.py index ea7f97948854d..fca3520737fd0 100644 --- a/crates/ruff/resources/test/fixtures/pep8_naming/N802.py +++ b/crates/ruff/resources/test/fixtures/pep8_naming/N802.py @@ -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 diff --git a/crates/ruff/src/rules/pep8_naming/rules/invalid_function_name.rs b/crates/ruff/src/rules/pep8_naming/rules/invalid_function_name.rs index a95ec1d084a31..468b29dc7a2c4 100644 --- a/crates/ruff/src/rules/pep8_naming/rules/invalid_function_name.rs +++ b/crates/ruff/src/rules/pep8_naming/rules/invalid_function_name.rs @@ -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; }