summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshley Whetter <ashley@awhetter.co.uk>2017-07-26 04:15:57 +0100
committerAshley Whetter <ashley@awhetter.co.uk>2019-02-09 13:22:36 -0800
commit278ab731a3f3e89c966d80c3b05554426183e863 (patch)
tree65251851a5ac8801deeb6e9f2d0a4c6a5988a250
parent8c022d5e4b13860889f5a41e30aacae0bccbb14c (diff)
downloadpylint-git-278ab731a3f3e89c966d80c3b05554426183e863.tar.gz
Fixed callback options needing to take an argument
-rw-r--r--pylint/config.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/pylint/config.py b/pylint/config.py
index 404176f65..ae1d87fd1 100644
--- a/pylint/config.py
+++ b/pylint/config.py
@@ -584,6 +584,11 @@ class OptionsManagerMixIn:
class NullAction(argparse.Action):
"""Doesn't store the value on the config."""
+ def __init__(self, *args, nargs=0, **kwargs):
+ super(OptionsManagerMixIn.NullAction, self).__init__(
+ *args, nargs=nargs, **kwargs
+ )
+
def __call__(self, *args, **kwargs):
pass
@@ -687,13 +692,15 @@ class OptionsManagerMixIn:
if "action" in optdict:
self._nocallback_options[provider] = opt
if optdict["action"] == "callback":
- pass
+ optdict["type"] = optdict["callback"]
+ optdict["action"] = self.NullAction
+ del optdict["callback"]
else:
callback = functools.partial(
self.cb_set_provider_option, None, "--" + str(opt), parser=None
)
optdict["type"] = callback
- optdict["action"] = self.NullAction
+ optdict.setdefault("action", "store")
# default is handled here and *must not* be given to optik if you
# want the whole machinery to work
if "default" in optdict: