[flake8-blind-except] Allow more logging methods (BLE001)#22057
Merged
ntBre merged 17 commits intoastral-sh:mainfrom Jan 14, 2026
Merged
[flake8-blind-except] Allow more logging methods (BLE001)#22057ntBre merged 17 commits intoastral-sh:mainfrom
flake8-blind-except] Allow more logging methods (BLE001)#22057ntBre merged 17 commits intoastral-sh:mainfrom
Conversation
…mpatible logging method
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| BLE001 | 32 | 0 | 32 | 0 | 0 |
| RUF100 | 3 | 3 | 0 | 0 | 0 |
critical, error and exception (BLE001)
chirizxc
reviewed
Dec 19, 2025
crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs
Outdated
Show resolved
Hide resolved
…test-cases for ``logging.warn`
chirizxc
reviewed
Dec 22, 2025
crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs
Outdated
Show resolved
Hide resolved
chirizxc
reviewed
Dec 22, 2025
crates/ruff_linter/src/rules/flake8_logging/rules/root_logger_call.rs
Outdated
Show resolved
Hide resolved
ntBre
reviewed
Dec 24, 2025
Contributor
ntBre
left a comment
There was a problem hiding this comment.
Thank you! This looks great overall. I Just had one suggestion about trimming down the number of test cases and one to share some code for the Truthiness checks.
I also think we should make this a preview (link is to an example preview function) change since the ecosystem check is showing a number of changes, including some now-unused noqa comments.
crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs
Outdated
Show resolved
Hide resolved
…info`` has been moved to the function and the number of tests has been reduced
ntBre
reviewed
Jan 1, 2026
Contributor
ntBre
left a comment
There was a problem hiding this comment.
Thanks! A few more small comments.
crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs
Outdated
Show resolved
Hide resolved
…xcept.rs Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
Contributor
|
(closing and re-opening to rerun the prek check) |
critical, error and exception (BLE001)flake8-blind-except] Allow more logging methods (BLE001)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix issue #21889 by checking that the logging method is one of the
debug,info,warning,error,exception,critical,logmethods that supportexc_infopassing. Also fixed the behavior in whichexc_infowas considered passed only when it was equal to the literalTrue, now theTruthinessof the expression is checked (we will leave additional checks to type checkers)Test Plan
Additional snapshot tests have been added for all logging functions, as well as tests in which an exception object is passed as
exc_info