-
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.
Support variable keys in static dictionary key rule
- Loading branch information
1 parent
c2c9997
commit 3836069
Showing
5 changed files
with
95 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
data = ["some", "Data"] | ||
constant = 5 | ||
|
||
# Ok | ||
# OK | ||
{value: value.upper() for value in data} | ||
{value.lower(): value.upper() for value in data} | ||
{v: v*v for v in range(10)} | ||
{(0, "a", v): v*v for v in range(10)} # Tuple with variable | ||
{v: v * v for v in range(10)} | ||
{(0, "a", v): v * v for v in range(10)} # Tuple with variable | ||
{constant: value.upper() for value in data for constant in data} | ||
|
||
# Errors | ||
{"key": value.upper() for value in data} | ||
{True: value.upper() for value in data} | ||
{0: value.upper() for value in data} | ||
{(1, "a"): value.upper() for value in data} # constant tuple | ||
{(1, "a"): value.upper() for value in data} # Constant tuple | ||
{constant: value.upper() for value in data} |
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
50 changes: 30 additions & 20 deletions
50
...ff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF011_RUF011.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
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