summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorcpopa <devnull@localhost>2014-07-12 12:08:41 +0300
committercpopa <devnull@localhost>2014-07-12 12:08:41 +0300
commit235ee6dd14de0678d4f219bd57624c10af816cd0 (patch)
treecd0988774c4c11fb203731be90b83f525c092ad8 /utils.py
parent738cfea5cdc05ee4a1cc7914188d507dfebcfea3 (diff)
downloadpylint-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.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/utils.py b/utils.py
index c6a7371..c2f1704 100644
--- a/utils.py
+++ b/utils.py
@@ -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