From patchwork Wed May 6 22:29:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 245253 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Wed, 6 May 2020 16:29:08 -0600 Subject: [PATCH 5/6] patman: Support warnings in the patch subject In-Reply-To: <20200506222910.152322-1-sjg@chromium.org> References: <20200506222910.152322-1-sjg@chromium.org> Message-ID: <20200506222910.152322-6-sjg@chromium.org> Sometimes checkpatch outputs problems in the patch subject. Add support for parsing this output and reporting it correctly. Signed-off-by: Simon Glass --- tools/patman/checkpatch.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 5426bb9e9e..5ae450d771 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -127,6 +127,7 @@ def CheckPatch(fname, verbose=False): warn_match = re_warning.match(line) file_match = re_file.match(line) check_match = re_check.match(line) + subject_match = line.startswith('Subject:') if err_match: item['msg'] = err_match.group(1) item['type'] = 'error' @@ -139,6 +140,9 @@ def CheckPatch(fname, verbose=False): elif file_match: item['file'] = file_match.group(1) item['line'] = int(file_match.group(2)) + elif subject_match: + item['file'] = '' + item['line'] = None return result @@ -157,7 +161,8 @@ def GetWarningMsg(col, msg_type, fname, line, msg): msg_type = col.Color(col.RED, msg_type) elif msg_type == 'check': msg_type = col.Color(col.MAGENTA, msg_type) - return '%s:%d: %s: %s\n' % (fname, line, msg_type, msg) + line_str = '' if line is None else '%d' % line + return '%s:%s: %s: %s\n' % (fname, line_str, msg_type, msg) def CheckPatches(verbose, args): '''Run the checkpatch.pl script on each patch'''