mirror of https://github.com/astral-sh/ruff
parent
46f8961292
commit
5dbb4dd823
|
|
@ -30,7 +30,7 @@ pub(super) fn match_function_def(
|
||||||
body,
|
body,
|
||||||
decorator_list,
|
decorator_list,
|
||||||
),
|
),
|
||||||
_ => panic!("Found non-FunctionDef in match_name"),
|
_ => panic!("Found non-FunctionDef in match_function_def"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ impl Violation for MissingReturnTypeClassMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ## What it does
|
/// ## 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`.
|
/// `Any`.
|
||||||
///
|
///
|
||||||
/// ## Why is this bad?
|
/// ## 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
|
/// ## References
|
||||||
/// - [PEP 484](https://www.python.org/dev/peps/pep-0484/#the-any-type)
|
/// - [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)
|
/// - [Mypy: The Any type](https://mypy.readthedocs.io/en/stable/kinds_of_types.html#the-any-type)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct AnyType {
|
pub struct AnyType {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue