diff options
author | cpopa <devnull@localhost> | 2014-07-12 12:08:41 +0300 |
---|---|---|
committer | cpopa <devnull@localhost> | 2014-07-12 12:08:41 +0300 |
commit | 235ee6dd14de0678d4f219bd57624c10af816cd0 (patch) | |
tree | cd0988774c4c11fb203731be90b83f525c092ad8 /utils.py | |
parent | 738cfea5cdc05ee4a1cc7914188d507dfebcfea3 (diff) | |
download | pylint-235ee6dd14de0678d4f219bd57624c10af816cd0.tar.gz |
Don't emit 'no-name-in-module' for ignored modules. Closes issue #223.
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -742,3 +742,23 @@ def register_plugins(linter, directory): module.register(linter) imported[base] = 1 +def get_global_option(checker, option, default=None): + """ Retrieve an option defined by the given *checker* or + by all known option providers. + + It will look in the list of all options providers + until the given *option* will be found. + If the option wasn't found, the *default* value will be returned. + """ + # First, try in the given checker's config. + # After that, look in the options providers. + + try: + return getattr(checker.config, option.replace("-", "_")) + except AttributeError: + pass + for provider in checker.linter.options_providers: + for options in provider.options: + if options[0] == option: + return getattr(provider.config, option.replace("-", "_")) + return default |