Skip to content

Commit 523174e

Browse files
authored
[flake8-async] Make ASYNC100 example error out-of-the-box (astral-sh#18993)
## Summary Part of astral-sh#18972 This PR makes [cancel-scope-no-checkpoint (ASYNC100)](https://docs.astral.sh/ruff/rules/cancel-scope-no-checkpoint/#cancel-scope-no-checkpoint-async100)'s example error out-of-the-box [Old example](https://play.ruff.rs/6a399ae5-9b89-4438-b808-6604f1e40a70) ```py async def func(): async with asyncio.timeout(2): do_something() ``` [New example](https://play.ruff.rs/c44db531-d2f8-4a61-9e04-e5fc0ea989e3) ```py import asyncio async def func(): async with asyncio.timeout(2): do_something() ``` ## Test Plan <!-- How was it tested? --> N/A, no functionality/tests affected
1 parent ed2e903 commit 523174e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ use crate::rules::flake8_async::helpers::MethodName;
2121
///
2222
/// ## Example
2323
/// ```python
24+
/// import asyncio
25+
///
26+
///
2427
/// async def func():
2528
/// async with asyncio.timeout(2):
2629
/// do_something()
2730
/// ```
2831
///
2932
/// Use instead:
3033
/// ```python
34+
/// import asyncio
35+
///
36+
///
3137
/// async def func():
3238
/// async with asyncio.timeout(2):
3339
/// do_something()

0 commit comments

Comments
 (0)