-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
questionAsking for support or clarificationAsking for support or clarification
Description
test.py
Minimal code snipped that reproduces the bug:
import logging
logger = logging.getLogger()
try:
pass
except Exception:
logger.error("Error", exc_info=True)
Ruff output
The command I've invoked: ruff --isolated --select G,TRY test.py
test.py:7:5: TRY400 Use `logging.exception` instead of `logging.error`
test.py:7:12: G201 Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)`
Found 2 errors.
After changing the test.py file to:
- logger.error("Error", exc_info=True)
+ logger.error("Error")I get only:
test.py:7:5: TRY400 Use `logging.exception` instead of `logging.error`
Found 1 error.
Maybe the broader TRY400 rule is enough, in favor of G201. Not sure what's the rationale for overlapping/duplicate rules in ruff.
ruff --version
ruff 0.0.269
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionAsking for support or clarificationAsking for support or clarification