-
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.
## Summary This adds a fix for the `duplicate-bases` rule that removes the duplicate base from the class definition. ## Test Plan `cargo nextest run duplicate_bases`, `cargo insta review`.
- Loading branch information
Showing
4 changed files
with
225 additions
and
14 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
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
157 changes: 151 additions & 6 deletions
157
...rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.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,11 +1,156 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pylint/mod.rs | ||
--- | ||
duplicate_bases.py:8:12: PLE0241 Duplicate base `A` for class `B` | ||
| | ||
8 | class B(A, A): | ||
| ^ PLE0241 | ||
9 | ... | ||
| | ||
duplicate_bases.py:13:13: PLE0241 [*] Duplicate base `A` for class `F1` | ||
| | ||
12 | # Duplicate base class is last. | ||
13 | class F1(A, A): | ||
| ^ PLE0241 | ||
14 | ... | ||
| | ||
= help: Remove duplicate base | ||
|
||
ℹ Safe fix | ||
10 10 | | ||
11 11 | | ||
12 12 | # Duplicate base class is last. | ||
13 |-class F1(A, A): | ||
13 |+class F1(A): | ||
14 14 | ... | ||
15 15 | | ||
16 16 | | ||
|
||
duplicate_bases.py:17:13: PLE0241 [*] Duplicate base `A` for class `F2` | ||
| | ||
17 | class F2(A, A,): | ||
| ^ PLE0241 | ||
18 | ... | ||
| | ||
= help: Remove duplicate base | ||
|
||
ℹ Safe fix | ||
14 14 | ... | ||
15 15 | | ||
16 16 | | ||
17 |-class F2(A, A,): | ||
17 |+class F2(A,): | ||
18 18 | ... | ||
19 19 | | ||
20 20 | | ||
|
||
duplicate_bases.py:23:5: PLE0241 [*] Duplicate base `A` for class `F3` | ||
| | ||
21 | class F3( | ||
22 | A, | ||
23 | A | ||
| ^ PLE0241 | ||
24 | ): | ||
25 | ... | ||
| | ||
= help: Remove duplicate base | ||
|
||
ℹ Safe fix | ||
19 19 | | ||
20 20 | | ||
21 21 | class F3( | ||
22 |- A, | ||
23 22 | A | ||
24 23 | ): | ||
25 24 | ... | ||
|
||
duplicate_bases.py:30:5: PLE0241 [*] Duplicate base `A` for class `F4` | ||
| | ||
28 | class F4( | ||
29 | A, | ||
30 | A, | ||
| ^ PLE0241 | ||
31 | ): | ||
32 | ... | ||
| | ||
= help: Remove duplicate base | ||
|
||
ℹ Safe fix | ||
27 27 | | ||
28 28 | class F4( | ||
29 29 | A, | ||
30 |- A, | ||
31 30 | ): | ||
32 31 | ... | ||
33 32 | | ||
|
||
duplicate_bases.py:36:13: PLE0241 [*] Duplicate base `A` for class `G1` | ||
| | ||
35 | # Duplicate base class is not last. | ||
36 | class G1(A, A, B): | ||
| ^ PLE0241 | ||
37 | ... | ||
| | ||
= help: Remove duplicate base | ||
|
||
ℹ Safe fix | ||
33 33 | | ||
34 34 | | ||
35 35 | # Duplicate base class is not last. | ||
36 |-class G1(A, A, B): | ||
36 |+class G1(A, B): | ||
37 37 | ... | ||
38 38 | | ||
39 39 | | ||
|
||
duplicate_bases.py:40:13: PLE0241 [*] Duplicate base `A` for class `G2` | ||
| | ||
40 | class G2(A, A, B,): | ||
| ^ PLE0241 | ||
41 | ... | ||
| | ||
= help: Remove duplicate base | ||
|
||
ℹ Safe fix | ||
37 37 | ... | ||
38 38 | | ||
39 39 | | ||
40 |-class G2(A, A, B,): | ||
40 |+class G2(A, B,): | ||
41 41 | ... | ||
42 42 | | ||
43 43 | | ||
|
||
duplicate_bases.py:46:5: PLE0241 [*] Duplicate base `A` for class `G3` | ||
| | ||
44 | class G3( | ||
45 | A, | ||
46 | A, | ||
| ^ PLE0241 | ||
47 | B | ||
48 | ): | ||
| | ||
= help: Remove duplicate base | ||
|
||
ℹ Safe fix | ||
43 43 | | ||
44 44 | class G3( | ||
45 45 | A, | ||
46 |- A, | ||
47 46 | B | ||
48 47 | ): | ||
49 48 | ... | ||
|
||
duplicate_bases.py:54:5: PLE0241 [*] Duplicate base `A` for class `G4` | ||
| | ||
52 | class G4( | ||
53 | A, | ||
54 | A, | ||
| ^ PLE0241 | ||
55 | B, | ||
56 | ): | ||
| | ||
= help: Remove duplicate base | ||
|
||
ℹ Safe fix | ||
51 51 | | ||
52 52 | class G4( | ||
53 53 | A, | ||
54 |- A, | ||
55 54 | B, | ||
56 55 | ): | ||
57 56 | ... |