-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[flake8-blind-except] Allow more logging methods (BLE001)
#22057
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
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)
crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs
Outdated
Show resolved
Hide resolved
…test-cases for ``logging.warn`
crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_logging/rules/root_logger_call.rs
Outdated
Show resolved
Hide resolved
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! 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
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! 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>
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!
|
(closing and re-opening to rerun the prek check) |
critical, error and exception (BLE001)flake8-blind-except] Allow more logging methods (BLE001)
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