diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-09-19 17:53:53 +0000 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-09-19 17:53:53 +0000 |
commit | b1cb956b40605c1fbdb85a90a9fe002a46e5cf0c (patch) | |
tree | 8c007969b2ccf7e1fa6d095d611ad33aa6f218d2 | |
parent | 1f17d18b344876d273248dfdd96af92bd17770e0 (diff) | |
download | pylint-b1cb956b40605c1fbdb85a90a9fe002a46e5cf0c.tar.gz |
Abbreviations of command line options are not supported anymore.
Using abbreviations for CLI options was never considered to be
a feature of pylint, this fact being only a side effect of using optparse.
As this was the case, using --load-plugin or other abbreviation
for --load-plugins never actually worked, while it also didn't raise
an error. Closes issue #424.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | pylint/config.py | 6 | ||||
-rw-r--r-- | pylint/test/test_self.py | 6 |
3 files changed, 19 insertions, 1 deletions
@@ -287,6 +287,14 @@ ChangeLog for Pylint Closes issue #639. + * Abbreviations of command line options are not supported anymore. + + Using abbreviations for CLI options was never considered to be + a feature of pylint, this fact being only a side effect of using optparse. + As this was the case, using --load-plugin or other abbreviation + for --load-plugins never actually worked, while it also didn't raise + an error. Closes issue #424. + 2015-03-14 -- 1.4.3 diff --git a/pylint/config.py b/pylint/config.py index c9ab351..fb5c2da 100644 --- a/pylint/config.py +++ b/pylint/config.py @@ -316,6 +316,12 @@ class OptionParser(optparse.OptionParser): # Drop the last "\n", or the header if no options or option groups: return "".join(result[:-1]) + def _match_long_opt(self, opt): + """Disable abbreviations.""" + if opt not in self._long_opt: + raise optparse.BadOptionError(opt) + return opt + # pylint: disable=abstract-method; by design? class _ManHelpFormatter(optparse.HelpFormatter): diff --git a/pylint/test/test_self.py b/pylint/test/test_self.py index d1c9238..4fbfa39 100644 --- a/pylint/test/test_self.py +++ b/pylint/test/test_self.py @@ -101,7 +101,7 @@ class RunTC(unittest.TestCase): out = six.StringIO() self._run_pylint(args, out=out) actual_output = out.getvalue() - self.assertEqual(expected_output.strip(), actual_output.strip()) + self.assertIn(expected_output.strip(), actual_output.strip()) def test_pkginfo(self): """Make pylint check itself.""" @@ -243,6 +243,10 @@ class RunTC(unittest.TestCase): self._test_output([module, "--py3k", "-E", "--msg-template='{msg}'"], expected_output=expected) + def test_abbreviations_are_not_supported(self): + expected = "no such option: --load-plugin" + self._test_output([".", "--load-plugin"], expected_output=expected) + if __name__ == '__main__': unittest.main() |