diff options
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r-- | pylint/checkers/classes.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index ff4a73c..3d9144d 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -634,21 +634,25 @@ a metaclass class method.'} """ if not isinstance(node.value, astroid.Call): return + # check the function called is "classmethod" or "staticmethod" func = node.value.func if (not isinstance(func, astroid.Name) or func.name not in ('classmethod', 'staticmethod')): return + msg = ('no-classmethod-decorator' if func.name == 'classmethod' else 'no-staticmethod-decorator') # assignment must be at a class scope parent_class = node.scope() if not isinstance(parent_class, astroid.ClassDef): return + # Check if the arg passed to classmethod is a class member classmeth_arg = node.value.args[0] if not isinstance(classmeth_arg, astroid.Name): return + method_name = classmeth_arg.name if any(method_name == member.name for member in parent_class.mymethods()): |