Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions prospector/tools/pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def _error_message(self, filepath, message):
def _pylintrc_configure(self, pylintrc, linter):
errors = []
linter.load_default_plugins()
linter.config_from_file(pylintrc)
if hasattr(linter.config, 'load_plugins'):
are_plugins_loaded = linter.config_from_file(pylintrc)
if not are_plugins_loaded and hasattr(linter.config, 'load_plugins'):
for plugin in linter.config.load_plugins:
try:
linter.load_plugin_modules([plugin])
Expand Down
12 changes: 10 additions & 2 deletions prospector/tools/pylint/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pylint.__pkginfo__ import numversion as PYLINT_VERSION
if PYLINT_VERSION >= (1, 5):
from pylint.config import OptionsManagerMixIn
from pylint.utils import _splitstrip
else:
from logilab.common.configuration import OptionsManagerMixIn
from pylint.lint import PyLinter
Expand All @@ -17,11 +18,18 @@ def __init__(self, found_files, *args, **kwargs):
PyLinter.__init__(self, *args, **kwargs)

def config_from_file(self, config_file=None):
"""Will return `True` if plugins have been loaded. For pylint>=1.5. Else `False`."""
if PYLINT_VERSION >= (1, 5):
self.read_config_file(config_file)
if self.cfgfile_parser.has_option('MASTER', 'load-plugins'):
# pylint: disable=protected-access
plugins = _splitstrip(self.cfgfile_parser.get('MASTER', 'load-plugins'))
self.load_plugin_modules(plugins)
self.load_config_file()
else:
self.load_file_configuration(config_file)
return True

self.load_file_configuration(config_file)
return False

def reset_options(self):
# for example, we want to re-initialise the OptionsManagerMixin
Expand Down