-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
keep the aug assigns in tests/snapshots
- Loading branch information
1 parent
77f170b
commit 5ca6377
Showing
2 changed files
with
90 additions
and
87 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
175 changes: 88 additions & 87 deletions
175
...ylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.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 |
---|---|---|
@@ -1,152 +1,153 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pylint/mod.rs | ||
--- | ||
self_or_cls_assignment.py:4:9: PLW0642 Reassigned `cls` variable in class method | ||
self_or_cls_assignment.py:5:9: PLW0642 Reassigned `cls` variable in class method | ||
| | ||
2 | @classmethod | ||
3 | def list_fruits(cls) -> None: | ||
4 | cls = "apple" # PLW0642 | ||
4 | cls += "orange" # OK, augmented assignments are ignored | ||
5 | cls = "apple" # PLW0642 | ||
| ^^^ PLW0642 | ||
5 | cls: Fruit = "apple" # PLW0642 | ||
6 | *cls = "banana" # PLW0642 | ||
6 | cls: Fruit = "apple" # PLW0642 | ||
7 | *cls = "banana" # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:5:9: PLW0642 Reassigned `cls` variable in class method | ||
self_or_cls_assignment.py:6:9: PLW0642 Reassigned `cls` variable in class method | ||
| | ||
3 | def list_fruits(cls) -> None: | ||
4 | cls = "apple" # PLW0642 | ||
5 | cls: Fruit = "apple" # PLW0642 | ||
4 | cls += "orange" # OK, augmented assignments are ignored | ||
5 | cls = "apple" # PLW0642 | ||
6 | cls: Fruit = "apple" # PLW0642 | ||
| ^^^ PLW0642 | ||
6 | *cls = "banana" # PLW0642 | ||
7 | cls, blah = "apple", "orange" # PLW0642 | ||
7 | *cls = "banana" # PLW0642 | ||
8 | cls, blah = "apple", "orange" # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:6:10: PLW0642 Reassigned `cls` variable in class method | ||
self_or_cls_assignment.py:7:10: PLW0642 Reassigned `cls` variable in class method | ||
| | ||
4 | cls = "apple" # PLW0642 | ||
5 | cls: Fruit = "apple" # PLW0642 | ||
6 | *cls = "banana" # PLW0642 | ||
5 | cls = "apple" # PLW0642 | ||
6 | cls: Fruit = "apple" # PLW0642 | ||
7 | *cls = "banana" # PLW0642 | ||
| ^^^ PLW0642 | ||
7 | cls, blah = "apple", "orange" # PLW0642 | ||
8 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
8 | cls, blah = "apple", "orange" # PLW0642 | ||
9 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:7:9: PLW0642 Reassigned `cls` variable in class method | ||
| | ||
5 | cls: Fruit = "apple" # PLW0642 | ||
6 | *cls = "banana" # PLW0642 | ||
7 | cls, blah = "apple", "orange" # PLW0642 | ||
| ^^^ PLW0642 | ||
8 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
9 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:8:16: PLW0642 Reassigned `cls` variable in class method | ||
| | ||
6 | *cls = "banana" # PLW0642 | ||
7 | cls, blah = "apple", "orange" # PLW0642 | ||
8 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
| ^^^ PLW0642 | ||
9 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
self_or_cls_assignment.py:8:9: PLW0642 Reassigned `cls` variable in class method | ||
| | ||
6 | cls: Fruit = "apple" # PLW0642 | ||
7 | *cls = "banana" # PLW0642 | ||
8 | cls, blah = "apple", "orange" # PLW0642 | ||
| ^^^ PLW0642 | ||
9 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
10 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:9:16: PLW0642 Reassigned `cls` variable in class method | ||
| | ||
7 | cls, blah = "apple", "orange" # PLW0642 | ||
8 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
9 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
7 | *cls = "banana" # PLW0642 | ||
8 | cls, blah = "apple", "orange" # PLW0642 | ||
9 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
| ^^^ PLW0642 | ||
10 | | ||
11 | @classmethod | ||
10 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:13:9: PLW0642 Reassigned `cls` variable in class method | ||
self_or_cls_assignment.py:10:16: PLW0642 Reassigned `cls` variable in class method | ||
| | ||
8 | cls, blah = "apple", "orange" # PLW0642 | ||
9 | blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
10 | blah, [cls, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
| ^^^ PLW0642 | ||
11 | | ||
12 | @classmethod | ||
| | ||
11 | @classmethod | ||
12 | def add_fruits(cls, fruits, /) -> None: | ||
13 | cls = fruits # PLW0642 | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:14:9: PLW0642 Reassigned `cls` variable in class method | ||
| | ||
12 | @classmethod | ||
13 | def add_fruits(cls, fruits, /) -> None: | ||
14 | cls = fruits # PLW0642 | ||
| ^^^ PLW0642 | ||
14 | | ||
15 | def print_color(self) -> None: | ||
15 | | ||
16 | def print_color(self) -> None: | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:16:9: PLW0642 Reassigned `self` variable in instance method | ||
self_or_cls_assignment.py:18:9: PLW0642 Reassigned `self` variable in instance method | ||
| | ||
15 | def print_color(self) -> None: | ||
16 | self = "red" # PLW0642 | ||
16 | def print_color(self) -> None: | ||
17 | self += "blue" # OK, augmented assignments are ignored | ||
18 | self = "red" # PLW0642 | ||
| ^^^^ PLW0642 | ||
17 | self: Self = "red" # PLW0642 | ||
18 | *self = "blue" # PLW0642 | ||
19 | self: Self = "red" # PLW0642 | ||
20 | *self = "blue" # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:17:9: PLW0642 Reassigned `self` variable in instance method | ||
self_or_cls_assignment.py:19:9: PLW0642 Reassigned `self` variable in instance method | ||
| | ||
15 | def print_color(self) -> None: | ||
16 | self = "red" # PLW0642 | ||
17 | self: Self = "red" # PLW0642 | ||
17 | self += "blue" # OK, augmented assignments are ignored | ||
18 | self = "red" # PLW0642 | ||
19 | self: Self = "red" # PLW0642 | ||
| ^^^^ PLW0642 | ||
18 | *self = "blue" # PLW0642 | ||
19 | self, blah = "red", "blue" # PLW0642 | ||
20 | *self = "blue" # PLW0642 | ||
21 | self, blah = "red", "blue" # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:18:10: PLW0642 Reassigned `self` variable in instance method | ||
self_or_cls_assignment.py:20:10: PLW0642 Reassigned `self` variable in instance method | ||
| | ||
16 | self = "red" # PLW0642 | ||
17 | self: Self = "red" # PLW0642 | ||
18 | *self = "blue" # PLW0642 | ||
18 | self = "red" # PLW0642 | ||
19 | self: Self = "red" # PLW0642 | ||
20 | *self = "blue" # PLW0642 | ||
| ^^^^ PLW0642 | ||
19 | self, blah = "red", "blue" # PLW0642 | ||
20 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
21 | self, blah = "red", "blue" # PLW0642 | ||
22 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:19:9: PLW0642 Reassigned `self` variable in instance method | ||
self_or_cls_assignment.py:21:9: PLW0642 Reassigned `self` variable in instance method | ||
| | ||
17 | self: Self = "red" # PLW0642 | ||
18 | *self = "blue" # PLW0642 | ||
19 | self, blah = "red", "blue" # PLW0642 | ||
19 | self: Self = "red" # PLW0642 | ||
20 | *self = "blue" # PLW0642 | ||
21 | self, blah = "red", "blue" # PLW0642 | ||
| ^^^^ PLW0642 | ||
20 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
21 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
22 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
23 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:20:16: PLW0642 Reassigned `self` variable in instance method | ||
self_or_cls_assignment.py:22:16: PLW0642 Reassigned `self` variable in instance method | ||
| | ||
18 | *self = "blue" # PLW0642 | ||
19 | self, blah = "red", "blue" # PLW0642 | ||
20 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
20 | *self = "blue" # PLW0642 | ||
21 | self, blah = "red", "blue" # PLW0642 | ||
22 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
| ^^^^ PLW0642 | ||
21 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
23 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:21:16: PLW0642 Reassigned `self` variable in instance method | ||
self_or_cls_assignment.py:23:16: PLW0642 Reassigned `self` variable in instance method | ||
| | ||
19 | self, blah = "red", "blue" # PLW0642 | ||
20 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
21 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
21 | self, blah = "red", "blue" # PLW0642 | ||
22 | blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642 | ||
23 | blah, [self, blah2] = "apple", ("orange", "banana") # PLW0642 | ||
| ^^^^ PLW0642 | ||
22 | | ||
23 | def print_color(self, color, /) -> None: | ||
24 | | ||
25 | def print_color(self, color, /) -> None: | ||
| | ||
= help: Consider using a different variable name | ||
|
||
self_or_cls_assignment.py:24:9: PLW0642 Reassigned `self` variable in instance method | ||
self_or_cls_assignment.py:26:9: PLW0642 Reassigned `self` variable in instance method | ||
| | ||
23 | def print_color(self, color, /) -> None: | ||
24 | self = color | ||
25 | def print_color(self, color, /) -> None: | ||
26 | self = color | ||
| ^^^^ PLW0642 | ||
25 | | ||
26 | def ok(self) -> None: | ||
27 | | ||
28 | def ok(self) -> None: | ||
| | ||
= help: Consider using a different variable name |