Skip to content

Commit

Permalink
[flake8-logging-format] Fix the autofix title in logging-warn (`G…
Browse files Browse the repository at this point in the history
…010`) (astral-sh#11514)

## Summary

Rule `logging-warn` (`G010`) prescribes a change from `warn` to
`warning` and has a corresponding autofix, but the autofix is mistakenly
titled ```"Convert to `warn`"``` instead of ```"Convert to `warning`"```
(the latter is what the autofix actually does). Seems to be a plain
typo.
  • Loading branch information
monk-time committed May 24, 2024
1 parent 81275a6 commit 3e30962
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G010.py:6:9: G010 [*] Logging statement uses `warn` instead of `warning`
7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate
8 | logger.warn("Hello world!")
|
= help: Convert to `warn`
= help: Convert to `warning`

Safe fix
3 3 |
Expand All @@ -31,7 +31,7 @@ G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning`
9 |
10 | logging . warn("Hello World!")
|
= help: Convert to `warn`
= help: Convert to `warning`

Safe fix
5 5 |
Expand All @@ -52,7 +52,7 @@ G010.py:10:11: G010 [*] Logging statement uses `warn` instead of `warning`
11 |
12 | from logging import warn, warning, exception
|
= help: Convert to `warn`
= help: Convert to `warning`

Safe fix
7 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate
Expand All @@ -72,7 +72,7 @@ G010.py:13:1: G010 [*] Logging statement uses `warn` instead of `warning`
14 | warning("foo")
15 | exception("foo")
|
= help: Convert to `warn`
= help: Convert to `warning`

Safe fix
10 10 | logging . warn("Hello World!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl AlwaysFixableViolation for LoggingWarn {
}

fn fix_title(&self) -> String {
"Convert to `warn`".to_string()
"Convert to `warning`".to_string()
}
}

Expand Down

0 comments on commit 3e30962

Please sign in to comment.