ASYNC912: Warn on unnecessary checkpoints added to avoid ASYNC910/911
@jakkdl ci sta già lavorando.
Dal 1/12/2022.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
I've noticed a few places where await trio.sleep(0) is added in places that don't actually need a checkpoint, and so I've thought up a two-part plan to mitigate cargo-cult copy-paste coding.
- Instead of
await trio.sleep(0), suggestawait trio.lowlevel.checkpoint(). It's an identical runtime effect, but the name is much more suggestive of what's actually going on: "we need a checkpoint here for some low-level reason" ✅ - Refactoring the increasingly-large plugin file as suggested below.
- In each async function, for each
await trio.lowlevel.checkpoint(), check if there would be no 107/108 warnings emitted if that checkpoint was removed (in addition to any already-suggested-removals, of course).
I initially marked this as an "idea" issue rather than for implementation because while I'm fairly confident (1) is a good plan, (2) seems a little harder to implement. It's also triggering my "this feels pretty tedious" detector, but building a libCST-based autofixer also seems like a little too much duplication of effort, right? Even if we could autofix 105, 107, 108, 112, and 113; and hook it in to shed --refactor... tempting but probably not worth it 😕
Thoughts?
- Lingua principale
- Python
- Stelle
- 26
- Fork
- 10
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python-trio/flake8-async
-
Rename ASYNC126 to ASYNC4xx Apertarule improvement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
python-trio/flake8-async#457 · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
python-trio/flake8-async#475 · 1 commento ·
-
Warn about unused `noqa`s Apertanew rule
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
python-trio/flake8-async#454 · 1 commento ·
-
ASYNC103 for sync functions Apertarule improvement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
python-trio/flake8-async#447 · 5 commenti ·
-
good first issue
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
python-trio/flake8-async#396 · 1 commento ·
Tutte le issue di python-trio/flake8-async
Issue simili
-
essnmx good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
[Feature] 奇物选择添加优先级 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Giskard-AI/giskard-oss#2840 · 1 commento ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Apertaarea: repo bug perceived difficulty: 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
yeti-platform/yeti#1380 ·