diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2014-07-12 12:08:41 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2014-07-12 12:08:41 +0300 |
commit | d721022c01ecffe50c56e44ade4b61824a501af0 (patch) | |
tree | 69e4dcb18248c30170688e926afd7c11abd854d5 /checkers/variables.py | |
parent | 5814625d4cae7ef202860e6b732a1951505f3fd2 (diff) | |
download | pylint-git-d721022c01ecffe50c56e44ade4b61824a501af0.tar.gz |
Don't emit 'no-name-in-module' for ignored modules. Closes issue #223.
Diffstat (limited to 'checkers/variables.py')
-rw-r--r-- | checkers/variables.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index b84ad4f12..6cbcdb68d 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -25,6 +25,7 @@ from astroid import are_exclusive, builtin_lookup, AstroidBuildingException from logilab.common.modutils import file_from_modpath from pylint.interfaces import IAstroidChecker +from pylint.utils import get_global_option from pylint.checkers import BaseChecker from pylint.checkers.utils import (PYMETHODS, is_ancestor_name, is_builtin, is_defined_before, is_error, is_func_default, is_func_decorator, @@ -679,6 +680,8 @@ builtins. Remember that you should avoid to define new builtins when possible.' if the latest access name corresponds to a module, return it """ assert isinstance(module, astroid.Module), module + ignored_modules = get_global_option(self, 'ignored-modules', + default=[]) while module_names: name = module_names.pop(0) if name == '__dict__': @@ -689,7 +692,10 @@ builtins. Remember that you should avoid to define new builtins when possible.' if module is astroid.YES: return None except astroid.NotFoundError: - self.add_message('no-name-in-module', args=(name, module.name), node=node) + if module.name in ignored_modules: + return None + self.add_message('no-name-in-module', + args=(name, module.name), node=node) return None except astroid.InferenceError: return None |