-
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.
Avoid converting f-strings within Django
gettext
calls (#7898)
## Summary Django's `gettext` doesn't support f-strings, so we should avoid translating `.format` calls in those cases. Closes #7891.
- Loading branch information
1 parent
970f8b4
commit c033c40
Showing
4 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
crates/ruff_linter/resources/test/fixtures/pyupgrade/UP032_3.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.utils.translation import gettext | ||
|
||
long = 'long' | ||
split_to = 'split_to' | ||
gettext( | ||
'some super {} and complicated string so that the error code ' | ||
'E501 Triggers when this is not {} multi-line'.format( | ||
long, split_to) | ||
) |
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
4 changes: 4 additions & 0 deletions
4
...inter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_3.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,4 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs | ||
--- | ||
|