diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-05-12 00:20:09 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-05-12 00:20:09 +0300 |
commit | 0747d6387becc555e22ec6b8fcff3797ab1ee557 (patch) | |
tree | cbfa65f856fad5435631606f26a81fa87bf0250d /pylint/checkers/classes.py | |
parent | 67dd07bb7269c93b8b9385e3edf2ba5bc3ed95d3 (diff) | |
download | pylint-git-0747d6387becc555e22ec6b8fcff3797ab1ee557.tar.gz |
Don't emit attribute-defined-outside-init and access-member-before-definition for mixin classes.
Actual errors can occur in mixin classes, but this is controlled by the ignore-mixin-members option,
so if something is a legitimate error, then the user can pass --ignore-mixin-members=no
in order to check these in mixin classes as well. Closes issue #412.
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r-- | pylint/checkers/classes.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 060e16685..9c5ba9f35 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -31,7 +31,7 @@ from pylint.checkers.utils import ( PYMETHODS, overrides_a_method, check_messages, is_attr_private, is_attr_protected, node_frame_class, safe_infer, is_builtin_object, decorated_with_property, unimplemented_abstract_methods) -from pylint.utils import deprecated_option +from pylint.utils import deprecated_option, get_global_option import six if sys.version_info >= (3, 0): @@ -341,6 +341,14 @@ a metaclass class method.'} access to existent members """ # check access to existent members on non metaclass classes + ignore_mixins = get_global_option(self, 'ignore-mixin-members', + default=True) + if ignore_mixins and cnode.name[-5:].lower() == 'mixin': + # We are in a mixin class. No need to try to figure out if + # something is missing, since it is most likely that it will + # miss. + return + accessed = self._accessed.pop() if cnode.type != 'metaclass': self._check_accessed_members(cnode, accessed) |