`ASYNC119`: allow some context managers and async context managers to contain `yield` statements
- Dominant language
- Rust
- Stars
- 49.6k
- Forks
- 2.4k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 458
Description
### Summary
Context managers such as `contextlib.suppress` currently trigger `ASYNC119` when a `with` block using an instance of its surrounds `yield` statements in an async generator function. However, there is no risk that an exception is propagated at the wrong time in this case because that is literally what `contextlib.suppress` handles. Either it should be added to an exclude list, or users should be allowed to configure classes that bypass this rule.
Contributor guide
Research direction
Locate the ASYNC119 rule implementation and its tests, then inspect how context managers surrounding yield statements are detected. Decide whether the completed change should cover contextlib.suppress, configurable classes, or both, and add tests demonstrating the accepted behavior without weakening the rule for other context managers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100