Skip to content

Commit c5995c4

Browse files
authored
[flake8-async] Make ASYNC105 example error out-of-the-box (astral-sh#19002)
## Summary Part of astral-sh#18972 This PR makes [trio-sync-call (ASYNC105)](https://docs.astral.sh/ruff/rules/trio-sync-call/#trio-sync-call-async105)'s example error out-of-the-box [Old example](https://play.ruff.rs/5b267e01-1c0a-4902-949e-45fc46f8b0d0) ```py async def double_sleep(x): trio.sleep(2 * x) ``` [New example](https://play.ruff.rs/eba6ea40-ff88-4ea8-8cb4-cea472c15c53) ```py import trio async def double_sleep(x): trio.sleep(2 * x) ``` ## Test Plan <!-- How was it tested? --> N/A, no functionality/tests affected
1 parent 68f98cf commit c5995c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ use crate::{Edit, Fix, FixAvailability, Violation};
1818
///
1919
/// ## Example
2020
/// ```python
21+
/// import trio
22+
///
23+
///
2124
/// async def double_sleep(x):
2225
/// trio.sleep(2 * x)
2326
/// ```
2427
///
2528
/// Use instead:
2629
/// ```python
30+
/// import trio
31+
///
32+
///
2733
/// async def double_sleep(x):
2834
/// await trio.sleep(2 * x)
2935
/// ```

0 commit comments

Comments
 (0)