From a5c8e23904e417ccf24c8f7feb5531e6f6a6251a 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 e2a6017e91..a4c6334641 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 292a4b95de..d5167cfe67 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(