Only include ignore_unknown=True if option callbacks are invoked for values in the rc file.

authorTorsten Marek <shlomme@gmail.com>
changeset57bc18437068
branchdefault
phasedraft
hiddenno
parent revision#5146f54ae44a Do not crash if unknown messages appear in enable or disable settings in the configuration.
child revision<not specified>
files modified by this revision
lint.py
# HG changeset patch
# User Torsten Marek <shlomme@gmail.com>
# Date 1396992923 -7200
# Tue Apr 08 23:35:23 2014 +0200
# Node ID 57bc184370686ca3d141cada0db8d9c9301f0203
# Parent 5146f54ae44a466d0dde4600f8ebe8dd5cace83b
Only include ignore_unknown=True if option callbacks are invoked for values in the rc file.

diff --git a/lint.py b/lint.py
@@ -298,16 +298,14 @@
1          self.stats = None
2          # init options
3          self.options = options + PyLinter.make_options()
4          self.option_groups = option_groups + PyLinter.option_groups
5          self._options_methods = {
6 -            'enable': functools.partial(self.enable,
7 -                                        ignore_unknown=True),
8 -            'disable': functools.partial(self.disable,
9 -                                         ignore_unknown=True)}
10 -        self._bw_options_methods = {'disable-msg': self._options_methods['disable'],
11 -                                    'enable-msg': self._options_methods['enable']}
12 +            'enable': self.enable,
13 +            'disable': self.disable}
14 +        self._bw_options_methods = {'disable-msg': self.enable,
15 +                                    'enable-msg': self.disable}
16          full_version = '%%prog %s, \nastroid %s, common %s\nPython %s' % (
17              version, astroid_version, common_version, sys.version)
18          OptionsManagerMixIn.__init__(self, usage=__doc__,
19                                       version=full_version,
20                                       config_file=pylintrc or config.PYLINTRC)
@@ -390,11 +388,11 @@
21                      warn('%s is deprecated, replace it by %s' % (
22                          optname, optname.split('-')[0]), DeprecationWarning)
23                  value = check_csv(None, optname, value)
24                  if isinstance(value, (list, tuple)):
25                      for _id in value:
26 -                        meth(_id)
27 +                        meth(_id, ignore_unknown=True)
28                  else:
29                      meth(value)
30          elif optname == 'output-format':
31              self._reporter_name = value
32              # If the reporters are already available, load