summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura M?dioni <laura.medioni@logilab.fr>2015-10-29 14:43:10 +0100
committerLaura M?dioni <laura.medioni@logilab.fr>2015-10-29 14:43:10 +0100
commitdd419712a064c2ec25839492e8c3b2acccbd76a3 (patch)
tree7e96d0d18a18823eb34ec0776bfee67c09793758
parent171326299f836782edd6167ac15de4a738dd53f8 (diff)
downloadpylint-dd419712a064c2ec25839492e8c3b2acccbd76a3.tar.gz
improve style and fix typos regarding no_class/staticmethod_decorator
-rw-r--r--pylint/checkers/classes.py5
-rw-r--r--pylint/test/functional/no_classmethod_decorator.py2
-rw-r--r--pylint/test/functional/no_staticmethod_decorator.py2
3 files changed, 5 insertions, 4 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py
index ee3c985..d12f45d 100644
--- a/pylint/checkers/classes.py
+++ b/pylint/checkers/classes.py
@@ -633,8 +633,9 @@ a metaclass class method.'}
self._check_protected_attribute_access(node)
def _check_classmethod_declaration(self, node):
- """checks for uses of classmethod() instead of @classmethod decorator
+ """Checks for uses of classmethod() or staticmethod()
+ When a @classmethod or @staticmethod decorator should be used instead.
A message will be emitted only if the assignment is at a class scope
and only if the classmethod's argument belongs to the class where it
is defined.
@@ -645,7 +646,7 @@ a metaclass class method.'}
# 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')):
+ func.name not in ('classmethod', 'staticmethod')):
return
msg = ('no-classmethod-decorator' if func.name == 'classmethod' else
'no-staticmethod-decorator')
diff --git a/pylint/test/functional/no_classmethod_decorator.py b/pylint/test/functional/no_classmethod_decorator.py
index 205594d..f44dca5 100644
--- a/pylint/test/functional/no_classmethod_decorator.py
+++ b/pylint/test/functional/no_classmethod_decorator.py
@@ -1,4 +1,4 @@
-"""Checks classes methods are declared with a decorator if whithin the class
+"""Checks class methods are declared with a decorator if within the class
scope and if classmethod's argument is a member of the class
"""
diff --git a/pylint/test/functional/no_staticmethod_decorator.py b/pylint/test/functional/no_staticmethod_decorator.py
index 636b2a5..9e26454 100644
--- a/pylint/test/functional/no_staticmethod_decorator.py
+++ b/pylint/test/functional/no_staticmethod_decorator.py
@@ -1,4 +1,4 @@
-"""Checks static methods are declared with a decorator if whithin the class
+"""Checks static methods are declared with a decorator if within the class
scope and if static method's argument is a member of the class
"""