-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand 105 to check that nursery.start(...)
is awaited
#56
Comments
Could also make a check that nurseries only get named nursery, and that nothing else gets named nursery. |
Respectively no because there are sometimes good reasons not to (eg nested nurseries), and doesn't seem worth it (implementation complexity, false alarms, small benefits). |
Zac-HD
added a commit
that referenced
this issue
Nov 22, 2022
charliermarsh
pushed a commit
to astral-sh/ruff
that referenced
this issue
Nov 5, 2023
## Summary Adds `TRIO105` from the [flake8-trio plugin](https://github.com/Zac-HD/flake8-trio). The `MethodName` logic mirrors that of `TRIO100` to stay consistent within the plugin. It is at 95% parity with the exception of upstream also checking for a slightly more complex scenario where a call to `start()` on a `trio.Nursery` context should also be immediately awaited. Upstream plugin appears to just check for anything named `nursery` judging from [the relevant issue](python-trio/flake8-async#56). Unsure if we want to do so something similar or, alternatively, if there is some capability in ruff to check for calls made on this context some other way ## Test Plan Added a new fixture, based on [the one from upstream plugin](https://github.com/Zac-HD/flake8-trio/blob/main/tests/eval_files/trio105.py) ## Issue link Refers: #8451
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think we can just assume that almost all nurseries are named
nursery
and also that ~everything namednursery
is in fact a nursery, at which point this is a pretty simple addition change:https://github.com/Zac-HD/flake8-trio/blob/a900cffc2e47c36a9d0576cd384eb20ca33289b4/flake8_trio.py#L820-L821
plus tests etc.
The text was updated successfully, but these errors were encountered: