From fbc9e663473fa0416779f1d71109b4123f6c3365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:06:33 +0200 Subject: [PATCH] Accept a comma-separated list of messages IDs in ``--help-msg`` (#7490) --- doc/whatsnew/fragments/7471.bugfix | 3 +++ pylint/config/callback_actions.py | 6 +++++- tests/test_self.py | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 doc/whatsnew/fragments/7471.bugfix diff --git a/doc/whatsnew/fragments/7471.bugfix b/doc/whatsnew/fragments/7471.bugfix new file mode 100644 index 0000000000..b1b6f369c9 --- /dev/null +++ b/doc/whatsnew/fragments/7471.bugfix @@ -0,0 +1,3 @@ +``--help-msg`` now accepts a comma-separated list of message IDs again. + +Closes #7471 diff --git a/pylint/config/callback_actions.py b/pylint/config/callback_actions.py index 5c27bca35b..242629a88e 100644 --- a/pylint/config/callback_actions.py +++ b/pylint/config/callback_actions.py @@ -158,7 +158,11 @@ def __call__( option_string: str | None = "--help-msg", ) -> None: assert isinstance(values, (list, tuple)) - self.run.linter.msgs_store.help_message(values) + values_to_print: list[str] = [] + for msg in values: + assert isinstance(msg, str) + values_to_print += utils._check_csv(msg) + self.run.linter.msgs_store.help_message(values_to_print) sys.exit(0) diff --git a/tests/test_self.py b/tests/test_self.py index f2587c5c73..c382edb196 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -1229,6 +1229,7 @@ def test_output_of_callback_options( [["--help-msg", "W0101"], ":unreachable (W0101)", False], [["--help-msg", "WX101"], "No such message id", False], [["--help-msg"], "--help-msg: expected at least one argumen", True], + [["--help-msg", "C0102,C0103"], ":invalid-name (C0103):", False], ], ) def test_help_msg(