ASYNC912: Warn on unnecessary checkpoints added to avoid ASYNC910/911
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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?
- Lenguaje dominante
- Python
- Estrellas
- 26
- Forks
- 10
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python-trio/flake8-async
-
Rename ASYNC126 to ASYNC4xxAbiertorule improvement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
python-trio/flake8-async#457 · 1 reacción ·
-
Extend ASYNC401 to other formsPosiblemente ocupada @anshurajbisoyi98-ctrl la tomó hace 2 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
python-trio/flake8-async#475 · 1 comentario · 1 reacción ·
-
Warn about unused `noqa`sAbiertonew rule
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
python-trio/flake8-async#454 · 1 comentario ·
-
ASYNC103 for sync functionsAbiertorule improvement
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
python-trio/flake8-async#447 · 5 comentarios ·
-
New rule: `ASYNC233` for blocking `pathlib` methodsPosiblemente ocupada @paranoa233 la tomó hace 90 días. Abiertogood first issue
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
python-trio/flake8-async#396 · 1 comentario ·
Todos los issues de python-trio/flake8-async
Issues similares
-
feature:LinkChecker
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
digitalfabrik/integreat-cms#4594 ·
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
EleutherAI/lm-evaluation-harness#4319 ·
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
json_params_matcher fails on falsy top-level JSON primitives (0, False, "")Posiblemente ocupada @mayureshsonawane17 la tomó hoy. AbiertoWaiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 5 días