-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[flake8-blind-except] Change BLE001 to permit logging.critical(..., exc_info=True).
#19520
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
[flake8-blind-except] Change BLE001 to permit logging.critical(..., exc_info=True).
#19520
Conversation
Note that two inline suppressions are used. I expect, provided that my [PR](astral-sh/ruff#19520) is merged in, that these suppressions will become superfluous in a later version of Ruff.
ntBre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This makes sense to me. @MichaReiser does this need to go out in preview? blind-except (BLE001) is a stable rule.
I just had one minor docs nit, and could we add a test case or two? Maybe one example with exc_info without a lint and one without exc_info with a lint. These could go at the end of this file and basically be copies of the error case here:
ruff/crates/ruff_linter/resources/test/fixtures/flake8_blind_except/BLE.py
Lines 91 to 94 in d13228a
| try: | |
| pass | |
| except Exception: | |
| logging.error("...", exc_info=True) |
|
Our versioning policy is a bit vague here:
Given that this reduce violations, I'd say it's probably okay but it might be good to do a quick grep for |
|
I went through two pages of search results on GitHub and didn't find any instances of this pattern. Along with the clean ecosystem report, I think this is good to go once we add tests. |
ntBre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
BLE001 to permit logging.critical(..., exc_info=True).flake8-blind-except] Change BLE001 to permit logging.critical(..., exc_info=True).
Note that two inline suppressions are used. I expect, provided that my [PR](astral-sh/ruff#19520) is merged in, that these suppressions will become superfluous in a later version of Ruff.
Note that two inline suppressions are used. I expect, provided that my [PR](astral-sh/ruff#19520) is merged in, that these suppressions will become superfluous in a later version of Ruff.
Summary
Changing
BLE001(blind-except) so that it does not flagexceptclauses which includelogging.critical(..., exc_info=True).Test Plan
It passes the following (whereas the
mainbranch does not):Related: #19519