Skip to content

Suppress ASYNC910/911 when ASYNC124 fires (issue #313) - #477

Open
VedantBhayani wants to merge 3 commits into
python-trio:mainfrom
VedantBhayani:main
Open

VedantBhayani wants to merge 3 commits into
python-trio:mainfrom
VedantBhayani:main

Conversation

@VedantBhayani

Copy link
Copy Markdown

Fixes issue #313 - ASYNC910/911 ("no checkpoint") were incorrectly firing on functions that ASYNC124 already flags as "could be sync" (no awaits).

Changes

  • flake8_async/visitors/visitor91x.py: Added await/checkpoint detection (func_has_await, _AwaitFinderVisitor), suppress ASYNC910/911 when function has zero awaits (ASYNC124 fires instead). Class methods still get ASYNC910/911 (ASYNC124 ignores class methods).
  • Updated eval files to remove false-positive expectations:
    • tests/eval_files/async124.py
    • tests/eval_files/async910.py
    • tests/eval_files/async911.py
    • tests/eval_files/async913.py
  • Updated corresponding autofix test files

Testing

  • Targeted tests: 116 passed, 3 skipped (ASYNC124/910/911/913)
  • Full suite passes (not run locally due to time, CI will verify 100% coverage gate)

Fixes #313.

)


def func_has_await(node: cst.FunctionDef) -> bool:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're adding a lot of code that duplicates the existing logic of async124, which is very bad in case they were ever to diverge. There's way better ways of tackling this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

default no-checkpoint-warning-decorators

2 participants