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 <umang.jain@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham 2023-07-11 14:26:37 +01:00
parent 668a5e674a
commit b14d2cab12

View file

@ -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()