diff --git a/crates/ruff/src/rules/flake8_annotations/helpers.rs b/crates/ruff/src/rules/flake8_annotations/helpers.rs index cf11395072..d73825fe07 100644 --- a/crates/ruff/src/rules/flake8_annotations/helpers.rs +++ b/crates/ruff/src/rules/flake8_annotations/helpers.rs @@ -30,7 +30,7 @@ pub(super) fn match_function_def( body, decorator_list, ), - _ => panic!("Found non-FunctionDef in match_name"), + _ => panic!("Found non-FunctionDef in match_function_def"), } } diff --git a/crates/ruff/src/rules/flake8_annotations/rules/definition.rs b/crates/ruff/src/rules/flake8_annotations/rules/definition.rs index db0a2f5b86..aa5ef05607 100644 --- a/crates/ruff/src/rules/flake8_annotations/rules/definition.rs +++ b/crates/ruff/src/rules/flake8_annotations/rules/definition.rs @@ -376,7 +376,7 @@ impl Violation for MissingReturnTypeClassMethod { } /// ## What it does -/// Checks that an expression is annotated with a more specific type than +/// Checks that function arguments are annotated with a more specific type than /// `Any`. /// /// ## Why is this bad? @@ -399,9 +399,23 @@ impl Violation for MissingReturnTypeClassMethod { /// ... /// ``` /// +/// ## Known problems +/// +/// Type aliases are unsupported and can lead to false positives. +/// For example, the following will trigger this rule inadvertently: +/// ```python +/// from typing import Any +/// +/// MyAny = Any +/// +/// +/// def foo(x: MyAny): +/// ... +/// ``` +/// /// ## References /// - [PEP 484](https://www.python.org/dev/peps/pep-0484/#the-any-type) -/// - [`typing.Any`](https://docs.python.org/3/library/typing.html#typing.Any) +/// - [Python documentation: `typing.Any`](https://docs.python.org/3/library/typing.html#typing.Any) /// - [Mypy: The Any type](https://mypy.readthedocs.io/en/stable/kinds_of_types.html#the-any-type) #[violation] pub struct AnyType {