diff options
author | Michael Kefeder <oss@multiwave.ch> | 2015-11-19 17:20:05 +0100 |
---|---|---|
committer | Michael Kefeder <oss@multiwave.ch> | 2015-11-19 17:20:05 +0100 |
commit | 6f59c12b55765a3cc721864e8882f1e8e49bcb58 (patch) | |
tree | bfa517574e599f0cbb65a26bcbf59a36665cf164 /pylint/checkers/base.py | |
parent | 2fc6f58d5f5fb890f016283c66e7980fa79beac9 (diff) | |
download | pylint-6f59c12b55765a3cc721864e8882f1e8e49bcb58.tar.gz |
Ignore missing docstrings for decorated attribute setters and deleters
Closes issue #651.
Diffstat (limited to 'pylint/checkers/base.py')
-rw-r--r-- | pylint/checkers/base.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index cc7c786..74a1f64 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -1360,10 +1360,22 @@ class DocStringChecker(_BasicChecker): if self.config.no_docstring_rgx.match(node.name) is None: self._check_docstring('class', node) + @staticmethod + def _is_setter_or_deleter(node): + names = {'setter', 'deleter'} + for decorator in node.decorators.nodes: + if (isinstance(decorator, astroid.Attribute) + and decorator.attrname in names): + return True + return False + @check_messages('missing-docstring', 'empty-docstring') def visit_functiondef(self, node): if self.config.no_docstring_rgx.match(node.name) is None: ftype = node.is_method() and 'method' or 'function' + if node.decorators and self._is_setter_or_deleter(node): + return + if isinstance(node.parent.frame(), astroid.ClassDef): overridden = False confidence = (INFERENCE if has_known_bases(node.parent.frame()) |