def get_message_description()

in teamcity/pylint_reporter.py [0:0]


def get_message_description(linter, msgid):
    if hasattr(linter.msgs_store, "get_message_definitions"):
        definitions = linter.msgs_store.get_message_definitions(msgid)
    elif hasattr(linter.msgs_store, "get_message_definition"):
        definitions = [linter.msgs_store.get_message_definition(msgid)]
    elif hasattr(linter.msgs_store, "check_message_id"):
        definitions = [linter.msgs_store.check_message_id(msgid)]
    else:
        raise Exception("This version of linter.msgs_store is unsupported. "
                        "pylint version: " + pylint_version + ". " +
                        "linter.msgs_store type: " + get_class_fullname(linter.msgs_store))

    descriptions = []
    for definition in definitions:
        if hasattr(definition, 'descr'):
            descriptions.append(definition.descr)
        elif hasattr(definition, "description"):
            descriptions.append(definition.description)
        else:
            raise Exception("This version of message definition is unsupported. " +
                            "pylint version: " + pylint_version + ". " +
                            "definition type: " + get_class_fullname(definition))

    return " ".join(descriptions)