Some years ago, @Zac-HD wanted to lint for async antipatterns, and together
with @cooperlees built out some initial checks in flake8-async. However,
it quickly became clear that many checks would need to specific to
Trio (or
anyio, or rarely asyncio),
and so Zac went on to create flake8-trio.
Fast-forward to early 2024, and flake8-trio also supports anyio,
which makes the name and error code pretty confusing. Since it's become
a strict superset of this plugin, we decided to merge them under the
flake8-async name and add asyncio support here too - which should
simplify both direct use, and downstream use via ruff.
- ASYNC100: Warning about the use of a blocking http call inside an
async def - ASYNC101: Warning about the use of
open,time.sleepor methods insubprocess, inside anasync def. - ASYNC102: Warning about the use of unsafe methods in
osinside anasync def.
When you wish to add a check to flake8-async please ensure the following:
- This
README.mdgets a one line about your new warning - CHANGELOG gets added to a
## UNRELEASEDsection - Unittests are added showing the check hilight where it should and shouldn't
To run our test suite please use tox.
python3 -m venv --upgrade-deps /tmp/tfa
/tmp/tfa/bin/pip install tox
# Linting
/tmp/tfa/bin/tox -e check
# Test Running
/tmp/tfa/bin/tox -e test -- -n autoMIT