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 /utils.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 '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 |
