Commit 963d4df
Various small fixes (#445)
* Fix CI running extra tox envs, and ASYNC300 on return
In tox 4, `tox -e ""` is treated as "no env specified" and falls back
to the default envlist, so the "Run tests without flake8" step was
running every `py3xx-flake8` env whose interpreter tox could discover
on the runner (including the system Python 3.12), instead of a single
no-flake8 test run. Replace the trailing-comma empty env with a proper
`[testenv:no_flake8]` section and point CI at it.
Also allow `return asyncio.create_task(...)`: treat `Return` like
`Assign` in Visitor300, since the caller preserves the task.
Fixes #422
Fixes #398
* Address issue #310 points 1 and 4
1. Document using ruff's `lint.external` setting so that `# noqa: ASYNC...`
comments survive when both ruff and flake8-async are in use.
4. Apply the `self.novisit = True` fix proposed in #307 at the end of
`Visitor102.visit_Try`. The previous code happened to work because
the internal `visit_nodes` calls left `self.novisit` True on exit,
but relying on that is fragile; making it explicit matches the
pattern used elsewhere and documents the intent.
* Run compile() against tests/eval_files to catch syntax mistakes
ast.parse() accepts some code the bytecode compiler rejects (e.g.
`x = lambda: await foo()`, `return` outside a function), so a bad
test fixture could silently slip past the plugin's ast-based checks.
Add a new parametrized test that runs compile() on every
tests/eval_files/*.py. A handful of existing fixtures intentionally
contain such constructs to exercise edge cases; mark those with a new
`# NOCOMPILE` magic marker so the new test skips them while still
leaving the rest of the suite guarding against accidents.
Fixes #268
* Drop docs/test-only entries from changelog
Docs and test changes aren't user-visible, so they don't need a
changelog entry. The ASYNC300 behaviour change stays.
* Mark async911.py as # NOCOMPILE for Python 3.10
Python 3.10's compile() rejects nested async comprehensions inside an
async function with "asynchronous comprehension outside of an asynchronous
function"; 3.11 became permissive here. The file parses fine with
ast.parse on every supported version, which is all the plugin needs,
so tag it with the existing # NOCOMPILE marker (also in the matching
autofix fixture to keep the diff clean).
---------
Co-authored-by: Claude <[email protected]>1 parent 21af102 commit 963d4df
14 files changed
Lines changed: 69 additions & 3 deletions
File tree
- .github/workflows
- docs
- flake8_async/visitors
- tests
- autofix_files
- eval_files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
94 | 107 | | |
95 | 108 | | |
96 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
156 | 160 | | |
157 | 161 | | |
158 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
| 563 | + | |
563 | 564 | | |
564 | 565 | | |
565 | 566 | | |
| |||
573 | 574 | | |
574 | 575 | | |
575 | 576 | | |
| 577 | + | |
576 | 578 | | |
577 | 579 | | |
578 | 580 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
0 commit comments