Skip to content

Commit 12a1589

Browse files
Add override mention to ASYNC109 docs (#24666)
See: #24648 (comment)
1 parent dccb03d commit 12a1589

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

crates/ruff_linter/src/rules/flake8_async/rules/async_function_with_timeout.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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")]
7080
pub(crate) struct AsyncFunctionWithTimeout {

0 commit comments

Comments
 (0)