X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Fpatman%2Fcheckpatch.py;h=16d534b6ae07719908e8450246d96c88bed00ea9;hb=7d5b5e8965b3f0bdf91665cf654b9eaeb9b30e52;hp=2915d97950d32c3920ab6e93523c2f031a4d1065;hpb=e1a71f8b339220fa74c9cd5d36ae9c444c492e83;p=platform%2Fkernel%2Fu-boot.git diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 2915d97..16d534b 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -1,15 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0+ # Copyright (c) 2011 The Chromium OS Authors. # -# SPDX-License-Identifier: GPL-2.0+ -# import collections -import command -import gitutil import os import re import sys -import terminal + +from patman import command +from patman import gitutil +from patman import terminal +from patman import tools def FindCheckPatch(): top_level = gitutil.GetTopLevel() @@ -58,7 +59,7 @@ def CheckPatch(fname, verbose=False): 'stdout'] result = collections.namedtuple('CheckPatchResult', fields) result.ok = False - result.errors, result.warning, result.checks = 0, 0, 0 + result.errors, result.warnings, result.checks = 0, 0, 0 result.lines = 0 result.problems = [] chk = FindCheckPatch() @@ -71,13 +72,17 @@ def CheckPatch(fname, verbose=False): # total: 0 errors, 0 warnings, 159 lines checked # or: # total: 0 errors, 2 warnings, 7 checks, 473 lines checked - re_stats = re.compile('total: (\\d+) errors, (\d+) warnings, (\d+)') - re_stats_full = re.compile('total: (\\d+) errors, (\d+) warnings, (\d+)' + emacs_prefix = '(?:[0-9]{4}.*\.patch:[0-9]+: )?' + emacs_stats = '(?:[0-9]{4}.*\.patch )?' + re_stats = re.compile(emacs_stats + + 'total: (\\d+) errors, (\d+) warnings, (\d+)') + re_stats_full = re.compile(emacs_stats + + 'total: (\\d+) errors, (\d+) warnings, (\d+)' ' checks, (\d+)') re_ok = re.compile('.*has no obvious style problems') re_bad = re.compile('.*has style problems, please review') re_error = re.compile('ERROR: (.*)') - re_warning = re.compile('WARNING: (.*)') + re_warning = re.compile(emacs_prefix + 'WARNING:(?:[A-Z_]+:)? (.*)') re_check = re.compile('CHECK: (.*)') re_file = re.compile('#\d+: FILE: ([^:]*):(\d+):')