-
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.
[
pygrep_hooks
] - add autofix for deprecated_log_warn
(PGH002
)
- Loading branch information
1 parent
6183b8e
commit 8f676f3
Showing
4 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
39 changes: 39 additions & 0 deletions
39
...hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__preview__PGH002_PGH002_1.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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pygrep_hooks/mod.rs | ||
--- | ||
PGH002_1.py:4:1: PGH002 [*] `warn` is deprecated in favor of `warning` | ||
| | ||
2 | from logging import warn | ||
3 | | ||
4 | logging.warn("this is not ok") | ||
| ^^^^^^^^^^^^ PGH002 | ||
5 | warn("not ok") | ||
| | ||
= help: Replace with `warning` | ||
|
||
ℹ Safe fix | ||
1 1 | import logging | ||
2 2 | from logging import warn | ||
3 3 | | ||
4 |-logging.warn("this is not ok") | ||
4 |+logging.warning("this is not ok") | ||
5 5 | warn("not ok") | ||
6 6 | | ||
7 7 | logger = logging.getLogger(__name__) | ||
|
||
PGH002_1.py:8:1: PGH002 [*] `warn` is deprecated in favor of `warning` | ||
| | ||
7 | logger = logging.getLogger(__name__) | ||
8 | logger.warn("this is not ok") | ||
| ^^^^^^^^^^^ PGH002 | ||
| | ||
= help: Replace with `warning` | ||
|
||
ℹ Safe fix | ||
5 5 | warn("not ok") | ||
6 6 | | ||
7 7 | logger = logging.getLogger(__name__) | ||
8 |-logger.warn("this is not ok") | ||
8 |+logger.warning("this is not ok") | ||
|
||
|