From e7f7334e2956a9e707222e4c83de9ffeb15b8ac0 Mon Sep 17 00:00:00 2001 From: Sebastiaan ten Pas Date: Mon, 29 Nov 2021 09:15:42 +0000 Subject: [PATCH] Make teamcity-message compatibility with pylint >=2.12 --- teamcity/pylint_reporter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/teamcity/pylint_reporter.py b/teamcity/pylint_reporter.py index f25dec6..ef1b4d1 100644 --- a/teamcity/pylint_reporter.py +++ b/teamcity/pylint_reporter.py @@ -84,7 +84,12 @@ def handle_message(self, msg): def display_reports(self, layout): """Issues the final PyLint score as a TeamCity build statistic value""" try: - score = self.linter.stats['global_note'] + stats = self.linter.stats + score = getattr(stats, 'global_note', None) + + # Backwards compatibility for pylint version <2.12 + if score is None: + score = stats['global_note'] except (AttributeError, KeyError): pass else: