Skip to content

Commit 9e9f084

Browse files
[FIX] add support for pylint 2.3.0 (pylint-dev/pylint@da67a9d)
1 parent 501bf29 commit 9e9f084

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pylint_plugin_utils/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,18 @@ def suppress_message(linter, checker_method, message_id_or_symbol, test_func):
119119

120120
# pylint 2.0 renamed check_message_id to get_message_definition in:
121121
# https://github.com/PyCQA/pylint/commit/5ccbf9eaa54c0c302c9180bdfb745566c16e416d
122+
# pylint 2.3.0 renamed get_message_definition to get_message_definitions in:
123+
# https://github.com/PyCQA/pylint/commit/da67a9da682e51844fbc674229ff6619eb9c816a
122124
if hasattr(msgs_store, 'check_message_id'):
123-
get_message_definition = msgs_store.check_message_id
125+
get_message_definitions = msgs_store.check_message_id
126+
elif hasattr(msgs_store, 'get_message_definition'):
127+
get_message_definitions = msgs_store.get_message_definition
124128
else:
125-
get_message_definition = msgs_store.get_message_definition
129+
get_message_definitions = msgs_store.get_message_definitions
126130

127131
try:
128-
pylint_message = get_message_definition(message_id_or_symbol)
132+
pylint_message = get_message_definitions(message_id_or_symbol)
133+
pylint_message = pylint_message[0] if isinstance(pylint_message, (list, tuple)) else pylint_message
129134
symbols = [s for s in (pylint_message.msgid, pylint_message.symbol) if s is not None]
130135
except UnknownMessage:
131136
# This can happen due to mismatches of pylint versions and plugin expectations of available messages

0 commit comments

Comments
 (0)