diff --git a/pylint_plugin_utils/__init__.py b/pylint_plugin_utils/__init__.py index 917684d..8e97f8e 100644 --- a/pylint_plugin_utils/__init__.py +++ b/pylint_plugin_utils/__init__.py @@ -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