-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I'm observing that logging rules aren't flagged if a logger is imported from another module.
- A minimal code snippet that reproduces the bug.
If I set up logging here, both of these violations are flagged:
# logging_setup.py
import logging
linter = "ruff"
logging.info(f"Hello, {linter}!") # G004 flagged
logger = logging.getLogger(__name__)
logger.info(f"Hello, {linter}!") # G004 flaggedHowever, if I import logger into another module, the below identical violation is not flagged:
# my_module.py
from logging_setup import logger
linter = "ruff"
logger.info(f"Hello, {linter}!") # G004 *not* flagged- The command you invoked (e.g.,
ruff /path/to/file.py --fix), ideally including the--isolatedflag.
ruff .
- The current Ruff settings (any relevant sections from your
pyproject.toml).
"G" ruleset
- The current Ruff version (
ruff --version).
0.0.277
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working