summaryrefslogtreecommitdiff
path: root/util/lint
diff options
context:
space:
mode:
authorMartin Roth <martin@coreboot.org>2022-03-22 17:59:27 -0600
committerMartin L Roth <gaumless@tutanota.com>2022-05-28 01:25:37 +0000
commit9e33723d9bfe94318a086d04f34ca4850f54d857 (patch)
tree39d919eefe239de16fed3c52930e86573d28d099 /util/lint
parent619086d1056c73278fdeb0967421048e8e755bba (diff)
util/lint: Add commit message parsing to checkpatch_json script
The commit message wasn't being parsed because there's no filename associated with it in the patch output. This change adds the "filename" for the commit message in Gerrit for any errors that have a line number but no filename. calculations is intentionally misspelled as cacluations as a test. Change-Id: Ie7a2ef06419c7090c8e44b3b734b1edf966597cc Signed-off-by: Martin Roth <martin@coreboot.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63031 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Diffstat (limited to 'util/lint')
-rwxr-xr-xutil/lint/checkpatch_json.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/lint/checkpatch_json.py b/util/lint/checkpatch_json.py
index 81946cabc7..341bc57733 100755
--- a/util/lint/checkpatch_json.py
+++ b/util/lint/checkpatch_json.py
@@ -10,6 +10,7 @@ OUTPUT: json format output that can be used to post comment in gerrit
import os
import sys
import json
+import re
data = {}
data['comments'] = []
@@ -38,6 +39,11 @@ def parse_file(input_file):
file_path = temp[1].split(":")[0]
line_number = temp[1].split(":")[1]
update_struct( file_path.strip(), msg_output, str(line_number) )
+ elif re.search("^\d+:\Z",line) != "None" and line.startswith("#"):
+ file_path="/COMMIT_MSG"
+ line = line.replace('#', '')
+ line_number = int(line.split(":")[0]) + 2
+ update_struct( file_path.strip(), msg_output, str(line_number) )
else:
continue
fp.close()