-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect local logging module re-exports in flake8-logging-format
- Loading branch information
1 parent
af2a087
commit d8a6e9c
Showing
3 changed files
with
44 additions
and
27 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
crates/ruff/resources/test/fixtures/flake8_logging_format/G010.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import logging | ||
from distutils import log | ||
|
||
from logging_setup import logger | ||
|
||
logging.warn("Hello World!") | ||
log.warn("Hello world!") # This shouldn't be considered as a logger candidate | ||
logger.warn("Hello world!") |
38 changes: 28 additions & 10 deletions
38
...s/flake8_logging_format/snapshots/ruff__rules__flake8_logging_format__tests__G010.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
--- | ||
source: crates/ruff/src/rules/flake8_logging_format/mod.rs | ||
--- | ||
G010.py:4:9: G010 [*] Logging statement uses `warn` instead of `warning` | ||
G010.py:6:9: G010 [*] Logging statement uses `warn` instead of `warning` | ||
| | ||
2 | from distutils import log | ||
3 | | ||
4 | logging.warn("Hello World!") | ||
4 | from logging_setup import logger | ||
5 | | ||
6 | logging.warn("Hello World!") | ||
| ^^^^ G010 | ||
5 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate | ||
7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate | ||
8 | logger.warn("Hello world!") | ||
| | ||
= help: Convert to `warn` | ||
|
||
ℹ Fix | ||
1 1 | import logging | ||
2 2 | from distutils import log | ||
3 3 | | ||
4 |-logging.warn("Hello World!") | ||
4 |+logging.warning("Hello World!") | ||
5 5 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate | ||
4 4 | from logging_setup import logger | ||
5 5 | | ||
6 |-logging.warn("Hello World!") | ||
6 |+logging.warning("Hello World!") | ||
7 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate | ||
8 8 | logger.warn("Hello world!") | ||
|
||
G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` | ||
| | ||
6 | logging.warn("Hello World!") | ||
7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate | ||
8 | logger.warn("Hello world!") | ||
| ^^^^ G010 | ||
| | ||
= help: Convert to `warn` | ||
|
||
ℹ Fix | ||
5 5 | | ||
6 6 | logging.warn("Hello World!") | ||
7 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate | ||
8 |-logger.warn("Hello world!") | ||
8 |+logger.warning("Hello world!") | ||
|
||
|
This file contains 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