-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding B025: empty method in abstract base class with no abstract dec…
…orator
- Loading branch information
Showing
5 changed files
with
139 additions
and
23 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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import abc | ||
from abc import ABC | ||
from abc import abstractmethod | ||
from abc import abstractmethod as notabstract | ||
|
||
""" | ||
Should emit: | ||
B025 - on lines 13, 16, 19, 23, 31 | ||
""" | ||
|
||
|
||
class AbstractClass(ABC): | ||
def empty_1(self): # error | ||
... | ||
|
||
def empty_2(self): # error | ||
pass | ||
|
||
def empty_3(self): # error | ||
"""docstring""" | ||
... | ||
|
||
def empty_4(self): # error | ||
"""multiple ellipsis/pass""" | ||
... | ||
pass | ||
... | ||
pass | ||
|
||
@notabstract | ||
def empty_5(self): # error | ||
... | ||
|
||
@abstractmethod | ||
def abstract_1(self): | ||
... | ||
|
||
@abstractmethod | ||
def abstract_2(self): | ||
pass | ||
|
||
@abc.abstractmethod | ||
def abstract_3(self): | ||
... | ||
|
||
def body_1(self): | ||
print("foo") | ||
... | ||
|
||
def body_2(self): | ||
self.body_1() | ||
|
||
|
||
class NonAbstractClass: | ||
def empty_1(self): # safe | ||
... | ||
|
||
def empty_2(self): # safe | ||
pass |
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