diff options
author | Laura Médioni <laura.medioni@logilab.fr> | 2015-10-29 15:30:59 +0100 |
---|---|---|
committer | Laura Médioni <laura.medioni@logilab.fr> | 2015-10-29 15:30:59 +0100 |
commit | 7bde0d648d718ae6a8ee73746adea86d82ddac06 (patch) | |
tree | 93e83085f98ae2613f96364cbd420dcfbe99f380 /pylint/checkers/classes.py | |
parent | 5d34bbb1694862df673b42a8f87e33d188efdb31 (diff) | |
download | pylint-git-7bde0d648d718ae6a8ee73746adea86d82ddac06.tar.gz |
no-static/class-method: enhance the tests and fix the code accordingly
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r-- | pylint/checkers/classes.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index d12f45d03..014dd4a1d 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -651,7 +651,7 @@ a metaclass class method.'} msg = ('no-classmethod-decorator' if func.name == 'classmethod' else 'no-staticmethod-decorator') # assignment must be at a class scope - parent_class = node.parent + parent_class = node.scope() if not isinstance(parent_class, astroid.ClassDef): return # Check if the arg passed to classmethod is a class member @@ -659,9 +659,8 @@ a metaclass class method.'} if not isinstance(classmeth_arg, astroid.Name): return method_name = classmeth_arg.name - for member in parent_class.get_children(): - if (isinstance(member, astroid.FunctionDef) and - method_name == member.name): + for member in parent_class.mymethods(): + if method_name == member.name: self.add_message(msg, node=node.targets[0]) break |