Skip to content

Commit

Permalink
Document no issue on S6542 when inheriting from annotated class member
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-dequenne-sonarsource committed Nov 22, 2024
1 parent 0a4a5b8 commit 4fd7710
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
class ImportedParentWithoutMetaClass: ...

class ImportedParentWithMetaClass(metaclass=ABCMeta): ...

from typing import Callable
class MyClassWithAnnotatedMember:
my_member: Callable[[Any],Any] # No issue on nested values of "Callable"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any
from abc import ABCMeta
from useOfAnyAsTypeHintImported import ImportedParentWithoutMetaClass, ImportedParentWithMetaClass
from useOfAnyAsTypeHintImported import ImportedParentWithoutMetaClass, ImportedParentWithMetaClass, MyClassWithAnnotatedMember

class LocalParentWithMetaClass(metaclass=ABCMeta): ...

Expand All @@ -14,3 +14,7 @@ def imported_inherited_foo(self) -> Any: # Noncompliant
class ImportedWithMetaClassInherited(ImportedParentWithMetaClass):
def imported_inherited_foo(self) -> Any: # Noncompliant
...

class MyChild(MyClass):
def my_member(self, param: Any) -> Any: # OK, defined in parent
...

0 comments on commit 4fd7710

Please sign in to comment.