From patchwork Wed May 6 22:29:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 245254 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Wed, 6 May 2020 16:29:07 -0600 Subject: [PATCH 4/6] patman: Handle checkpatch output with notes and code In-Reply-To: <20200506222910.152322-1-sjg@chromium.org> References: <20200506222910.152322-1-sjg@chromium.org> Message-ID: <20200506222910.152322-5-sjg@chromium.org> If checkpatch is configured to output code we should ignore it. Similarly, notes should be ignored. Update the logic to handle these situations. Signed-off-by: Simon Glass --- tools/patman/checkpatch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 2cfa9778c6..5426bb9e9e 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -85,7 +85,8 @@ def CheckPatch(fname, verbose=False): re_warning = re.compile(emacs_prefix + 'WARNING:(?:[A-Z_]+:)? (.*)') re_check = re.compile('CHECK: (.*)') re_file = re.compile('#\d+: FILE: ([^:]*):(\d+):') - + re_note = re.compile('NOTE: (.*)') + indent = ' ' * 6 for line in result.stdout.splitlines(): if verbose: print(line) @@ -96,6 +97,14 @@ def CheckPatch(fname, verbose=False): result.problems.append(item) item = {} continue + if re_note.match(line): + continue + # Skip lines which quote code + if line.startswith(indent): + continue + # Skip code quotes and # + if line.startswith('+') or line.startswith('#'): + continue match = re_stats_full.match(line) if not match: match = re_stats.match(line)