From b14d2cab127b05399348cca31eb9190eee0f305f Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 11 Jul 2023 14:26:37 +0100 Subject: utils: checkstyle.py: Treat Malformed trailers as a CommitIssue If a Malformed trailer is identified the checkstyle script triggers a RuntimeError and stops processing the rest of the commit. A malformed trailer can be regarded as an issue in the commit and reported as such using the same method as other faults identified by the tool. Convert the RuntimeError into a CommitIssue and continue processing other trailers. Reviewed-by: Umang Jain Tested-by: Jacopo Mondi Signed-off-by: Kieran Bingham --- utils/checkstyle.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'utils/checkstyle.py') diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 3558740d..5a126806 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -479,7 +479,8 @@ class TrailersChecker(CommitChecker): for trailer in commit.trailers: match = TrailersChecker.trailer_regex.fullmatch(trailer) if not match: - raise RuntimeError(f"Malformed commit trailer '{trailer}'") + issues.append(CommitIssue(f"Malformed commit trailer '{trailer}'")) + continue key, value = match.groups() -- cgit v1.2.1