-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONARPY-2345 Document new S1172 FN when super class is ambiguous (#2164)
- Loading branch information
1 parent
9c6e537
commit 1df1fc5
Showing
3 changed files
with
22 additions
and
3 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
11 changes: 9 additions & 2 deletions
11
...checks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImport.py
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,18 @@ | ||
from unusedFunctionParameterImported import ImportedParent | ||
from unusedFunctionParameterImported import ImportedParent, ParentWithDuplicatedParent | ||
|
||
class ChildFromImported(ImportedParent): | ||
|
||
# SONARPY-2327 `method_defined_in_child_class_only` is not considered a member of ImportedParent class, thus S1172 is raised | ||
# SONARPY-1829 `method_defined_in_child_class_only` is not considered a member of ImportedParent class, thus S1172 is raised | ||
def method_defined_in_child_class_only(self, a): # Noncompliant | ||
# ^ | ||
return compute() | ||
|
||
def method_defined_in_child_class_only_and_not_used(self, a): # Noncompliant | ||
# ^ | ||
return compute() | ||
|
||
class ChildFromDuplicated(ParentWithDuplicatedParent): | ||
|
||
def do_something(self, a): # FN SONARPY-1829 ChildFromDuplicated has an unresolved type hierarchy, because of the duplicated parent classes | ||
return compute() | ||
|
9 changes: 9 additions & 0 deletions
9
...ecks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImported.py
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,3 +1,12 @@ | ||
class ImportedParent: | ||
def using_child_method(self): | ||
return self.method_defined_in_child_class_only(1,2) | ||
|
||
class DuplicatedParent: | ||
... | ||
|
||
class DuplicatedParent: | ||
... | ||
|
||
class ParentWithDuplicatedParent(DuplicatedParent): | ||
... |