Skip to content

Commit f982598

Browse files
committed
reduce diff in the snapshot
1 parent 5ca6377 commit f982598

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

crates/ruff_linter/resources/test/fixtures/pylint/self_or_cls_assignment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
class Fruit:
22
@classmethod
33
def list_fruits(cls) -> None:
4-
cls += "orange" # OK, augmented assignments are ignored
54
cls = "apple" # PLW0642
65
cls: Fruit = "apple" # PLW0642
6+
cls += "orange" # OK, augmented assignments are ignored
77
*cls = "banana" # PLW0642
88
cls, blah = "apple", "orange" # PLW0642
99
blah, (cls, blah2) = "apple", ("orange", "banana") # PLW0642
@@ -14,9 +14,9 @@ def add_fruits(cls, fruits, /) -> None:
1414
cls = fruits # PLW0642
1515

1616
def print_color(self) -> None:
17-
self += "blue" # OK, augmented assignments are ignored
1817
self = "red" # PLW0642
1918
self: Self = "red" # PLW0642
19+
self += "blue" # OK, augmented assignments are ignored
2020
*self = "blue" # PLW0642
2121
self, blah = "red", "blue" # PLW0642
2222
blah, (self, blah2) = "apple", ("orange", "banana") # PLW0642

crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0642_self_or_cls_assignment.py.snap

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
---
22
source: crates/ruff_linter/src/rules/pylint/mod.rs
33
---
4-
self_or_cls_assignment.py:5:9: PLW0642 Reassigned `cls` variable in class method
4+
self_or_cls_assignment.py:4:9: PLW0642 Reassigned `cls` variable in class method
55
|
6+
2 | @classmethod
67
3 | def list_fruits(cls) -> None:
7-
4 | cls += "orange" # OK, augmented assignments are ignored
8-
5 | cls = "apple" # PLW0642
8+
4 | cls = "apple" # PLW0642
99
| ^^^ PLW0642
10-
6 | cls: Fruit = "apple" # PLW0642
11-
7 | *cls = "banana" # PLW0642
10+
5 | cls: Fruit = "apple" # PLW0642
11+
6 | cls += "orange" # OK, augmented assignments are ignored
1212
|
1313
= help: Consider using a different variable name
1414

15-
self_or_cls_assignment.py:6:9: PLW0642 Reassigned `cls` variable in class method
15+
self_or_cls_assignment.py:5:9: PLW0642 Reassigned `cls` variable in class method
1616
|
17-
4 | cls += "orange" # OK, augmented assignments are ignored
18-
5 | cls = "apple" # PLW0642
19-
6 | cls: Fruit = "apple" # PLW0642
17+
3 | def list_fruits(cls) -> None:
18+
4 | cls = "apple" # PLW0642
19+
5 | cls: Fruit = "apple" # PLW0642
2020
| ^^^ PLW0642
21+
6 | cls += "orange" # OK, augmented assignments are ignored
2122
7 | *cls = "banana" # PLW0642
22-
8 | cls, blah = "apple", "orange" # PLW0642
2323
|
2424
= help: Consider using a different variable name
2525

2626
self_or_cls_assignment.py:7:10: PLW0642 Reassigned `cls` variable in class method
2727
|
28-
5 | cls = "apple" # PLW0642
29-
6 | cls: Fruit = "apple" # PLW0642
28+
5 | cls: Fruit = "apple" # PLW0642
29+
6 | cls += "orange" # OK, augmented assignments are ignored
3030
7 | *cls = "banana" # PLW0642
3131
| ^^^ PLW0642
3232
8 | cls, blah = "apple", "orange" # PLW0642
@@ -36,7 +36,7 @@ self_or_cls_assignment.py:7:10: PLW0642 Reassigned `cls` variable in class metho
3636

3737
self_or_cls_assignment.py:8:9: PLW0642 Reassigned `cls` variable in class method
3838
|
39-
6 | cls: Fruit = "apple" # PLW0642
39+
6 | cls += "orange" # OK, augmented assignments are ignored
4040
7 | *cls = "banana" # PLW0642
4141
8 | cls, blah = "apple", "orange" # PLW0642
4242
| ^^^ PLW0642
@@ -77,32 +77,31 @@ self_or_cls_assignment.py:14:9: PLW0642 Reassigned `cls` variable in class metho
7777
|
7878
= help: Consider using a different variable name
7979

80-
self_or_cls_assignment.py:18:9: PLW0642 Reassigned `self` variable in instance method
80+
self_or_cls_assignment.py:17:9: PLW0642 Reassigned `self` variable in instance method
8181
|
8282
16 | def print_color(self) -> None:
83-
17 | self += "blue" # OK, augmented assignments are ignored
84-
18 | self = "red" # PLW0642
83+
17 | self = "red" # PLW0642
8584
| ^^^^ PLW0642
86-
19 | self: Self = "red" # PLW0642
87-
20 | *self = "blue" # PLW0642
85+
18 | self: Self = "red" # PLW0642
86+
19 | self += "blue" # OK, augmented assignments are ignored
8887
|
8988
= help: Consider using a different variable name
9089

91-
self_or_cls_assignment.py:19:9: PLW0642 Reassigned `self` variable in instance method
90+
self_or_cls_assignment.py:18:9: PLW0642 Reassigned `self` variable in instance method
9291
|
93-
17 | self += "blue" # OK, augmented assignments are ignored
94-
18 | self = "red" # PLW0642
95-
19 | self: Self = "red" # PLW0642
92+
16 | def print_color(self) -> None:
93+
17 | self = "red" # PLW0642
94+
18 | self: Self = "red" # PLW0642
9695
| ^^^^ PLW0642
96+
19 | self += "blue" # OK, augmented assignments are ignored
9797
20 | *self = "blue" # PLW0642
98-
21 | self, blah = "red", "blue" # PLW0642
9998
|
10099
= help: Consider using a different variable name
101100

102101
self_or_cls_assignment.py:20:10: PLW0642 Reassigned `self` variable in instance method
103102
|
104-
18 | self = "red" # PLW0642
105-
19 | self: Self = "red" # PLW0642
103+
18 | self: Self = "red" # PLW0642
104+
19 | self += "blue" # OK, augmented assignments are ignored
106105
20 | *self = "blue" # PLW0642
107106
| ^^^^ PLW0642
108107
21 | self, blah = "red", "blue" # PLW0642
@@ -112,7 +111,7 @@ self_or_cls_assignment.py:20:10: PLW0642 Reassigned `self` variable in instance
112111

113112
self_or_cls_assignment.py:21:9: PLW0642 Reassigned `self` variable in instance method
114113
|
115-
19 | self: Self = "red" # PLW0642
114+
19 | self += "blue" # OK, augmented assignments are ignored
116115
20 | *self = "blue" # PLW0642
117116
21 | self, blah = "red", "blue" # PLW0642
118117
| ^^^^ PLW0642

0 commit comments

Comments
 (0)