From b4bb5ce629294e5a0b186c6824ffe231bd86c3c7 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 30 May 2022 10:22:28 +0300 Subject: utils: checkstyle.py: Fix color bleed If issue.line is None, the the terminal color is never reset back to normal. This causes the yellow color to bleed. Signed-off-by: Tomi Valkeinen Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- utils/checkstyle.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 61783165..f0248d65 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -760,9 +760,11 @@ def check_file(top_level, commit, filename): if len(issues): issues = sorted(issues, key=lambda i: i.line_number) for issue in issues: - print('%s#%u: %s' % (Colours.fg(Colours.Yellow), issue.line_number, issue.msg)) + print('%s#%u: %s%s' % (Colours.fg(Colours.Yellow), issue.line_number, + issue.msg, Colours.reset())) if issue.line is not None: - print('+%s%s' % (issue.line.rstrip(), Colours.reset())) + print('%s+%s%s' % (Colours.fg(Colours.Yellow), issue.line.rstrip(), + Colours.reset())) return len(formatted_diff) + len(issues) -- cgit v1.2.1