Skip to content

Commit

Permalink
[refs #10] The ProspectorLinter no longer resets options unless expli…
Browse files Browse the repository at this point in the history
…citly required to do so (which is the case when prospector configures pylint itself). When a .pylintrc is provided, the options should not be reset as this loses the ability to register certaion options defined in the pylintrc file.
  • Loading branch information
carlio committed Jan 2, 2015
1 parent 94efe25 commit 30c8f1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions prospector/tools/pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,10 @@ def _prospector_configure(self, prospector_config, linter):

def _pylintrc_configure(self, pylintrc, linter):
linter.load_default_plugins()
import pdb; pdb.set_trace()
linter.load_file_configuration(pylintrc)

def configure(self, prospector_config, found_files):

linter = ProspectorLinter(found_files)

extra_sys_path = found_files.get_minimal_syspath()

# create a list of packages, but don't include packages which are
Expand Down Expand Up @@ -139,11 +136,10 @@ def configure(self, prospector_config, found_files):
# does not appear first in the path
sys.path = list(extra_sys_path) + sys.path

self._args = linter.load_command_line_configuration(check_paths)

ext_found = False
configured_by = None

linter = ProspectorLinter(found_files)
if prospector_config.use_external_config('pylint'):
# try to find a .pylintrc
pylintrc = prospector_config.external_config_location('pylint')
Expand All @@ -158,9 +154,13 @@ def configure(self, prospector_config, found_files):
# load it!
configured_by = pylintrc
ext_found = True

self._args = linter.load_command_line_configuration(check_paths)
self._pylintrc_configure(pylintrc, linter)

if not ext_found:
linter.reset_options()
self._args = linter.load_command_line_configuration(check_paths)
self._prospector_configure(prospector_config, linter)

# we don't want similarity reports right now
Expand Down
1 change: 1 addition & 0 deletions prospector/tools/pylint/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, found_files, *args, **kwargs):

# do some additional things!

def reset_options(self):
# for example, we want to re-initialise the OptionsManagerMixin
# to supress the config error warning
# pylint: disable=W0233
Expand Down

0 comments on commit 30c8f1d

Please sign in to comment.