Skip to content
Merged
Changes from all commits
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
10 changes: 9 additions & 1 deletion pylint_plugin_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,16 @@ def suppress_message(linter, checker_method, message_id_or_symbol, test_func):
# Therefore here, we try the new attribute name, and fall back to the old version for
# compatability with <=1.2 and >=1.3
msgs_store = getattr(linter, 'msgs_store', linter)

# pylint 2.0 renamed check_message_id to get_message_definition in:
# https://github.com/PyCQA/pylint/commit/5ccbf9eaa54c0c302c9180bdfb745566c16e416d
if hasattr(msgs_store, 'check_message_id'):
get_message_definition = msgs_store.check_message_id
else:
get_message_definition = msgs_store.get_message_definition

try:
pylint_message = msgs_store.check_message_id(message_id_or_symbol)
pylint_message = get_message_definition(message_id_or_symbol)
symbols = [s for s in (pylint_message.msgid, pylint_message.symbol) if s is not None]
except UnknownMessage:
# This can happen due to mismatches of pylint versions and plugin expectations of available messages
Expand Down