Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept a comma-separated list of messages IDs in --help-msg #7490

Merged
merged 3 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/7471.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
``--help-msg`` now accepts a comma-separated list of message IDs again.

Closes #7471
2 changes: 2 additions & 0 deletions pylint/config/callback_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ def __call__(
option_string: str | None = "--help-msg",
) -> None:
assert isinstance(values, (list, tuple))
assert isinstance(values[0], str)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we change the typing line 157 then ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typing comes from argparse. I believe mypy starts complaining if we narrow down in the signature.

values = values[0].split(",")
self.run.linter.msgs_store.help_message(values)
sys.exit(0)

Expand Down
1 change: 1 addition & 0 deletions tests/test_self.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down