summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-10-20 19:15:40 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2015-10-20 19:15:40 +0300
commitf6f5d270e7cfadb3dc0a3966c2edf4e322361fac (patch)
treea37ba3877db6ba37ac8c78d0fa48c0df17af60a7
parent050fc46ebc5d4ddfc50b7553f4af336172431ac5 (diff)
downloadpylint-f6f5d270e7cfadb3dc0a3966c2edf4e322361fac.tar.gz
Obsolete options are not present by default in the generated configuration file.
Closes issue #632.
-rw-r--r--ChangeLog3
-rw-r--r--pylint/config.py3
-rw-r--r--pylint/lint.py4
-rw-r--r--pylint/test/test_self.py6
-rw-r--r--pylint/utils.py3
5 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d6c9a7..7424066 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@ ChangeLog for Pylint
--
+ * Obsolete options are not present by default in the generated
+ configuration file. Closes issue #632.
+
* non-iterator-returned can detect classes with iterator-metaclasses.
Closes issue #679.
diff --git a/pylint/config.py b/pylint/config.py
index fb5c2da..490f932 100644
--- a/pylint/config.py
+++ b/pylint/config.py
@@ -554,7 +554,8 @@ class OptionsManagerMixIn(object):
if section in skipsections:
continue
options = [(n, d, v) for (n, d, v) in options
- if d.get('type') is not None]
+ if d.get('type') is not None
+ and not d.get('deprecated')]
if not options:
continue
if section not in sections:
diff --git a/pylint/lint.py b/pylint/lint.py
index 698f3e6..b0257a1 100644
--- a/pylint/lint.py
+++ b/pylint/lint.py
@@ -736,7 +736,6 @@ class PyLinter(config.OptionsManagerMixIn,
with _patch_sysmodules():
self._parallel_check(files_or_modules)
-
def _parallel_task(self, files_or_modules):
# Prepare configuration for child linters.
filter_options = {'symbols', 'include-ids', 'long-help'}
@@ -744,6 +743,9 @@ class PyLinter(config.OptionsManagerMixIn,
child_config = {}
for opt_providers in six.itervalues(self._all_options):
for optname, optdict, val in opt_providers.options_and_values():
+ if optdict.get('deprecated'):
+ continue
+
if optname not in filter_options:
child_config[optname] = utils._format_option_value(
optdict, val)
diff --git a/pylint/test/test_self.py b/pylint/test/test_self.py
index b430b12..324cc16 100644
--- a/pylint/test/test_self.py
+++ b/pylint/test/test_self.py
@@ -145,6 +145,12 @@ class RunTC(unittest.TestCase):
messages = parser.get('MESSAGES CONTROL', 'disable').split(",")
self.assertIn('suppressed-message', messages)
+ def test_generate_rcfile_no_obsolete_methods(self):
+ out = six.StringIO()
+ self._run_pylint(["--generate-rcfile"], out=out)
+ output = out.getvalue()
+ self.assertNotIn("profile", output)
+
def _test_deprecated_options(self, option, expected):
out = six.StringIO()
self._run_pylint([option, "--rcfile=", "pylint.config"], out=out)
diff --git a/pylint/utils.py b/pylint/utils.py
index e34e8e8..2f8de80 100644
--- a/pylint/utils.py
+++ b/pylint/utils.py
@@ -997,7 +997,8 @@ def deprecated_option(shortname=None, opt_type=None, help_msg=None):
'hide': True,
'type': opt_type,
'action': 'callback',
- 'callback': _warn_deprecated
+ 'callback': _warn_deprecated,
+ 'deprecated': True
}
if shortname:
option['shortname'] = shortname