python-trio / flake8-async

Highly opinionated linter for Trio code
https://flake8-async.readthedocs.io
MIT License
17 stars 2 forks source link

add --exception-suppress-context-manager #254

Closed jakkdl closed 4 months ago

jakkdl commented 4 months ago

Pretty straightforward. I wouldn't be totally shocked if this breaks something else in ASYNC91x, but I've spent a while trying to figure out edge cases and come up empty.

If you want support for from contextlib import suppress without having to specify suppress in the flag, it should be pretty doable to track the import like with other utility visitors.

Zac-HD commented 4 months ago

If you want support for from contextlib import suppress without having to specify suppress in the flag, it should be pretty doable to track the import like with other utility visitors.

If this is reasonable, it'd definitely be nice to have.

jakkdl commented 4 months ago

from contextlib import suppress as xxx ended up handling more cases than I initially planned to, but once I had the core implementation it was easy to add onto it and would've had to fight with type-checking/raise error messages/etc for some of the cases otherwise.