diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-10-28 12:24:18 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-10-28 12:24:18 +0200 |
commit | 0766420cee6c10d9af8e48052d1a95b334b6c451 (patch) | |
tree | d4fea8f783e3de2f6fca7361003c06df16b75168 /checkers | |
parent | 893f7d717749d969712090ac04c90a3117c10581 (diff) | |
download | pylint-git-0766420cee6c10d9af8e48052d1a95b334b6c451.tar.gz |
Add a new option, 'exclude-protected'.
This option can be used for excluding members from the
protected-access warning. Closes issue #48.
Diffstat (limited to 'checkers')
-rw-r--r-- | checkers/classes.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/checkers/classes.py b/checkers/classes.py index 4895f18f3..3be5bd746 100644 --- a/checkers/classes.py +++ b/checkers/classes.py @@ -295,7 +295,16 @@ a class method.'} 'help' : 'List of valid names for the first argument in \ a metaclass class method.'} ), - ) + ('exclude-protected', + { + 'default': ( + # namedtuple public API. + '_asdict', '_fields', '_replace', '_source', '_make'), + 'type': 'csv', + 'metavar': '<protected access exclusions>', + 'help': ('List of member names, which should be excluded ' + 'from the protected access warning.')} + )) def __init__(self, linter=None): BaseChecker.__init__(self, linter) @@ -616,7 +625,8 @@ a metaclass class method.'} ''' attrname = node.attrname - if is_attr_protected(attrname): + if (is_attr_protected(attrname) and + attrname not in self.config.exclude_protected): klass = node_frame_class(node) |