File tree Expand file tree Collapse file tree
crates/ruff_linter/src/rules/flake8_async/rules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,15 @@ use ruff_python_ast::PythonVersion;
3838/// `anyio.move_on_after`, false positives from this rule can be avoided
3939/// by using a different parameter name.
4040///
41+ /// This rule exempts methods decorated with [`@typing.override`][override].
42+ /// Removing a parameter from a subclass method may cause type checkers to
43+ /// complain about a violation of the Liskov Substitution Principle if it
44+ /// means that the method now incompatibly overrides a method defined on a
45+ /// superclass. Explicitly decorating an overriding method with `@override`
46+ /// signals to Ruff that the method is intended to override a superclass
47+ /// method and that a type checker will enforce that it does so; Ruff
48+ /// therefore knows that it should not enforce this rule on such methods.
49+ ///
4150/// ## Example
4251///
4352/// ```python
@@ -65,6 +74,7 @@ use ruff_python_ast::PythonVersion;
6574/// - [`trio` timeouts](https://trio.readthedocs.io/en/stable/reference-core.html#cancellation-and-timeouts)
6675///
6776/// ["structured concurrency"]: https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#timeouts-and-cancellation
77+ /// [override]: https://docs.python.org/3/library/typing.html#typing.override
6878#[ derive( ViolationMetadata ) ]
6979#[ violation_metadata( stable_since = "0.5.0" ) ]
7080pub ( crate ) struct AsyncFunctionWithTimeout {
You can’t perform that action at this time.
0 commit comments