-
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.
## Summary Closes #6958. If a method has the `override` decorator, there is nothing you can do about incorrect dunder methods, so they should be ignored. ## Test Plan Overridden incorrect dunder method was added to the tests to verify ruff doesn't catch it when evaluating the file. Snapshot changes are all just line number changes
- Loading branch information
Showing
3 changed files
with
50 additions
and
41 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
66 changes: 33 additions & 33 deletions
66
...rules/pylint/snapshots/ruff__rules__pylint__tests__PLW3201_bad_dunder_method_name.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,61 +1,61 @@ | ||
--- | ||
source: crates/ruff/src/rules/pylint/mod.rs | ||
--- | ||
bad_dunder_method_name.py:2:9: PLW3201 Bad or misspelled dunder method name `_init_`. (bad-dunder-name) | ||
bad_dunder_method_name.py:5:9: PLW3201 Bad or misspelled dunder method name `_init_`. (bad-dunder-name) | ||
| | ||
1 | class Apples: | ||
2 | def _init_(self): # [bad-dunder-name] | ||
4 | class Apples: | ||
5 | def _init_(self): # [bad-dunder-name] | ||
| ^^^^^^ PLW3201 | ||
3 | pass | ||
6 | pass | ||
| | ||
|
||
bad_dunder_method_name.py:5:9: PLW3201 Bad or misspelled dunder method name `__hello__`. (bad-dunder-name) | ||
bad_dunder_method_name.py:8:9: PLW3201 Bad or misspelled dunder method name `__hello__`. (bad-dunder-name) | ||
| | ||
3 | pass | ||
4 | | ||
5 | def __hello__(self): # [bad-dunder-name] | ||
6 | pass | ||
7 | | ||
8 | def __hello__(self): # [bad-dunder-name] | ||
| ^^^^^^^^^ PLW3201 | ||
6 | print("hello") | ||
9 | print("hello") | ||
| | ||
|
||
bad_dunder_method_name.py:8:9: PLW3201 Bad or misspelled dunder method name `__init_`. (bad-dunder-name) | ||
bad_dunder_method_name.py:11:9: PLW3201 Bad or misspelled dunder method name `__init_`. (bad-dunder-name) | ||
| | ||
6 | print("hello") | ||
7 | | ||
8 | def __init_(self): # [bad-dunder-name] | ||
9 | print("hello") | ||
10 | | ||
11 | def __init_(self): # [bad-dunder-name] | ||
| ^^^^^^^ PLW3201 | ||
9 | # author likely unintentionally misspelled the correct init dunder. | ||
10 | pass | ||
12 | # author likely unintentionally misspelled the correct init dunder. | ||
13 | pass | ||
| | ||
|
||
bad_dunder_method_name.py:12:9: PLW3201 Bad or misspelled dunder method name `_init_`. (bad-dunder-name) | ||
bad_dunder_method_name.py:15:9: PLW3201 Bad or misspelled dunder method name `_init_`. (bad-dunder-name) | ||
| | ||
10 | pass | ||
11 | | ||
12 | def _init_(self): # [bad-dunder-name] | ||
13 | pass | ||
14 | | ||
15 | def _init_(self): # [bad-dunder-name] | ||
| ^^^^^^ PLW3201 | ||
13 | # author likely unintentionally misspelled the correct init dunder. | ||
14 | pass | ||
16 | # author likely unintentionally misspelled the correct init dunder. | ||
17 | pass | ||
| | ||
|
||
bad_dunder_method_name.py:16:9: PLW3201 Bad or misspelled dunder method name `___neg__`. (bad-dunder-name) | ||
bad_dunder_method_name.py:19:9: PLW3201 Bad or misspelled dunder method name `___neg__`. (bad-dunder-name) | ||
| | ||
14 | pass | ||
15 | | ||
16 | def ___neg__(self): # [bad-dunder-name] | ||
17 | pass | ||
18 | | ||
19 | def ___neg__(self): # [bad-dunder-name] | ||
| ^^^^^^^^ PLW3201 | ||
17 | # author likely accidentally added an additional `_` | ||
18 | pass | ||
20 | # author likely accidentally added an additional `_` | ||
21 | pass | ||
| | ||
|
||
bad_dunder_method_name.py:20:9: PLW3201 Bad or misspelled dunder method name `__inv__`. (bad-dunder-name) | ||
bad_dunder_method_name.py:23:9: PLW3201 Bad or misspelled dunder method name `__inv__`. (bad-dunder-name) | ||
| | ||
18 | pass | ||
19 | | ||
20 | def __inv__(self): # [bad-dunder-name] | ||
21 | pass | ||
22 | | ||
23 | def __inv__(self): # [bad-dunder-name] | ||
| ^^^^^^^ PLW3201 | ||
21 | # author likely meant to call the invert dunder method | ||
22 | pass | ||
24 | # author likely meant to call the invert dunder method | ||
25 | pass | ||
| | ||
|
||
|