diff --git a/python-checks/src/test/java/org/sonar/python/checks/UnusedFunctionParameterCheckTest.java b/python-checks/src/test/java/org/sonar/python/checks/UnusedFunctionParameterCheckTest.java index d7a210e813..f111becb6d 100644 --- a/python-checks/src/test/java/org/sonar/python/checks/UnusedFunctionParameterCheckTest.java +++ b/python-checks/src/test/java/org/sonar/python/checks/UnusedFunctionParameterCheckTest.java @@ -33,7 +33,10 @@ void test() { @Test void test_import() { PythonCheckVerifier.verify( - List.of("src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImport.py","src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImported.py"), + List.of( + "src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImport.py", + "src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImported.py" + ), new UnusedFunctionParameterCheck() ); } diff --git a/python-checks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImport.py b/python-checks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImport.py index 1c851d3b83..0541b5bfbe 100644 --- a/python-checks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImport.py +++ b/python-checks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImport.py @@ -1,7 +1,8 @@ -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() @@ -9,3 +10,9 @@ def method_defined_in_child_class_only(self, a): # Noncompliant 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() + diff --git a/python-checks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImported.py b/python-checks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImported.py index d952cbbf96..83be1ded3c 100644 --- a/python-checks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImported.py +++ b/python-checks/src/test/resources/checks/unusedFunctionParameter/unusedFunctionParameterImported.py @@ -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): + ...