-
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.
## Summary add autofix for `deprecated_log_warn` (`PGH002`) ## Test Plan `cargo test` --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
- Loading branch information
1 parent
9a2f3e2
commit 2bddde2
Showing
4 changed files
with
117 additions
and
8 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
59 changes: 59 additions & 0 deletions
59
...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,59 @@ | ||
--- | ||
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:5:1: PGH002 [*] `warn` is deprecated in favor of `warning` | ||
| | ||
4 | logging.warn("this is not ok") | ||
5 | warn("not ok") | ||
| ^^^^ PGH002 | ||
6 | | ||
7 | logger = logging.getLogger(__name__) | ||
| | ||
= help: Replace with `warning` | ||
|
||
ℹ Safe fix | ||
2 2 | from logging import warn | ||
3 3 | | ||
4 4 | logging.warn("this is not ok") | ||
5 |-warn("not ok") | ||
5 |+logging.warning("not ok") | ||
6 6 | | ||
7 7 | logger = logging.getLogger(__name__) | ||
8 8 | logger.warn("this is not ok") | ||
|
||
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") | ||
|
||
|