Skip to content

Commit

Permalink
[deleted messages] Fix helper function for old names of deleted messages
Browse files Browse the repository at this point in the history
Previousely they were considered unknown names.
  • Loading branch information
Pierre-Sassoulas committed Jun 6, 2022
1 parent d7aca42 commit ac6615a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions pylint/message/_deleted_message_ids.py
Expand Up @@ -131,7 +131,9 @@ def is_deleted_symbol(symbol: str) -> str | None:
"""Return the explanation for removal if the message was removed."""
for explanation, deleted_messages in DELETED_MESSAGES_IDS.items():
for deleted_message in deleted_messages:
if symbol == deleted_message.symbol:
if symbol == deleted_message.symbol or any(
symbol == m[1] for m in deleted_message.old_names
):
return explanation
return None

Expand All @@ -141,6 +143,8 @@ def is_deleted_msgid(msgid: str) -> str | None:
"""Return the explanation for removal if the message was removed."""
for explanation, deleted_messages in DELETED_MESSAGES_IDS.items():
for deleted_message in deleted_messages:
if msgid == deleted_message.msgid:
if msgid == deleted_message.msgid or any(
msgid == m[0] for m in deleted_message.old_names
):
return explanation
return None
4 changes: 2 additions & 2 deletions tests/functional/b/bad_option_value.py
Expand Up @@ -21,6 +21,6 @@
# pylint:enable=W1622 # [useless-option-value]

# Standard disable with deleted old name symbol of deleted message
# pylint: disable=no-space-after-operator # [bad-option-value] <= This is wrong
# pylint: disable=no-space-after-operator # [useless-option-value]
# Standard disable with deleted old name msgid of deleted message
# pylint: disable=C0323 # [bad-option-value] <= This is wrong
# pylint: disable=C0323 # [useless-option-value]
4 changes: 2 additions & 2 deletions tests/functional/b/bad_option_value.txt
Expand Up @@ -7,5 +7,5 @@ useless-option-value:14:0:None:None::"Useless option value for 'disable-next', '
unknown-option-value:17:0:None:None::Unknown option value for 'enable', expected a valid pylint message and got 'W04044':HIGH
useless-option-value:19:0:None:None::"Useless option value for 'enable', 'dict-values-not-iterating' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH
useless-option-value:21:0:None:None::"Useless option value for 'enable', 'W1622' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH
bad-option-value:24:0:None:None::Bad option value for 'disable', expected a valid pylint message and got 'no-space-after-operator':HIGH
bad-option-value:26:0:None:None::Bad option value for 'disable', expected a valid pylint message and got 'C0323':HIGH
useless-option-value:24:0:None:None::"Useless option value for 'disable', 'no-space-after-operator' was removed from pylint, see https://github.com/PyCQA/pylint/pull/3577.":HIGH
useless-option-value:26:0:None:None::"Useless option value for 'disable', 'C0323' was removed from pylint, see https://github.com/PyCQA/pylint/pull/3577.":HIGH

0 comments on commit ac6615a

Please sign in to comment.