Detect unneeded async keywords on functions (#9966)

## Summary

This change adds a rule to detect functions declared `async` but lacking
any of `await`, `async with`, or `async for`. This resolves #9951.

## Test Plan

This change was tested by following
https://docs.astral.sh/ruff/contributing/#rule-testing-fixtures-and-snapshots
and adding positive and negative cases for each of `await` vs nothing,
`async with` vs `with`, and `async for` vs `for`.
This commit is contained in:
plredmond
2024-04-16 10:32:29 -07:00
committed by GitHub
parent 45db695c47
commit 65edbfe62f
8 changed files with 308 additions and 0 deletions

1
ruff.schema.json generated
View File

@@ -3619,6 +3619,7 @@
"RUF026",
"RUF027",
"RUF028",
"RUF029",
"RUF1",
"RUF10",
"RUF100",