-
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.
Fix false positive in
PLR6301
(#7933)
## Summary Don't report a diagnostic if the method contains a `super()` call. Closes #6961 ## Test Plan `cargo test`
- Loading branch information
1 parent
bd06cbe
commit e261eb7
Showing
4 changed files
with
68 additions
and
32 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
39 changes: 15 additions & 24 deletions
39
...src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6301_no_self_use.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,39 +1,30 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pylint/mod.rs | ||
--- | ||
no_self_use.py:5:28: PLR6301 Method `developer_greeting` could be a function or static method | ||
no_self_use.py:7:28: PLR6301 Method `developer_greeting` could be a function or static method | ||
| | ||
4 | class Person: | ||
5 | def developer_greeting(self, name): # [no-self-use] | ||
6 | class Person: | ||
7 | def developer_greeting(self, name): # [no-self-use] | ||
| ^^^^ PLR6301 | ||
6 | print(f"Greetings {name}!") | ||
8 | print(f"Greetings {name}!") | ||
| | ||
|
||
no_self_use.py:8:20: PLR6301 Method `greeting_1` could be a function or static method | ||
| | ||
6 | print(f"Greetings {name}!") | ||
7 | | ||
8 | def greeting_1(self): # [no-self-use] | ||
| ^^^^ PLR6301 | ||
9 | print("Hello!") | ||
| | ||
|
||
no_self_use.py:11:20: PLR6301 Method `greeting_2` could be a function or static method | ||
no_self_use.py:10:20: PLR6301 Method `greeting_1` could be a function or static method | ||
| | ||
9 | print("Hello!") | ||
10 | | ||
11 | def greeting_2(self): # [no-self-use] | ||
8 | print(f"Greetings {name}!") | ||
9 | | ||
10 | def greeting_1(self): # [no-self-use] | ||
| ^^^^ PLR6301 | ||
12 | print("Hi!") | ||
11 | print("Hello!") | ||
| | ||
|
||
no_self_use.py:55:25: PLR6301 Method `abstract_method` could be a function or static method | ||
no_self_use.py:13:20: PLR6301 Method `greeting_2` could be a function or static method | ||
| | ||
53 | class Sub(Base): | ||
54 | @override | ||
55 | def abstract_method(self): | ||
| ^^^^ PLR6301 | ||
56 | print("concrete method") | ||
11 | print("Hello!") | ||
12 | | ||
13 | def greeting_2(self): # [no-self-use] | ||
| ^^^^ PLR6301 | ||
14 | print("Hi!") | ||
| | ||
|
||
|