summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2014-07-12 12:08:41 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2014-07-12 12:08:41 +0300
commitd721022c01ecffe50c56e44ade4b61824a501af0 (patch)
tree69e4dcb18248c30170688e926afd7c11abd854d5 /utils.py
parent5814625d4cae7ef202860e6b732a1951505f3fd2 (diff)
downloadpylint-git-d721022c01ecffe50c56e44ade4b61824a501af0.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 c6a73713e..c2f1704e6 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