mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
[flake8-async] Sleep with >24 hour interval should usually sleep forever (ASYNC116) (#11498)
## Summary Addresses #8451 by implementing rule 116 to add an unsafe fix when sleep is used with a >24 hour interval to instead consider sleeping forever. This rule is added as async instead as I my understanding was that these trio rules would be moved to async anyway. There are a couple of TODOs, which address further extending the rule by adding support for lookups and evaluations, and also supporting `anyio`.
This commit is contained in:
parent
9a93409e1c
commit
ebdaf5765a
8 changed files with 321 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ mod tests {
|
|||
#[test_case(Rule::BlockingHttpCallInAsyncFunction, Path::new("ASYNC100.py"))]
|
||||
#[test_case(Rule::OpenSleepOrSubprocessInAsyncFunction, Path::new("ASYNC101.py"))]
|
||||
#[test_case(Rule::BlockingOsCallInAsyncFunction, Path::new("ASYNC102.py"))]
|
||||
#[test_case(Rule::SleepForeverCall, Path::new("ASYNC116.py"))]
|
||||
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
|
||||
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
|
||||
let diagnostics = test_path(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue