summaryrefslogtreecommitdiff
path: root/tools/patman/checkpatch.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-02-10 09:02:06 -0500
committerTom Rini <trini@konsulko.com>2022-02-10 09:19:44 -0500
commit2ccd2bc8c3580e00c51094c5cc2b3e2ead8d35c3 (patch)
tree4e7349b8831fee4b342a971025273d3cd042a2f9 /tools/patman/checkpatch.py
parent6662e5e406fdee26ba981dd4af3308f51f254f0a (diff)
parentf3078d4ea707931c2307a623ecf6e4d215b413d5 (diff)
Merge tag 'dm-pull-8feb22-take3' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
patman snake-case conversion binman fit improvements ACPI fixes and making MCFG available to ARM [trini: Update scripts/pylint.base] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools/patman/checkpatch.py')
-rw-r--r--tools/patman/checkpatch.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
index 8978df25c15..dd792efee0b 100644
--- a/tools/patman/checkpatch.py
+++ b/tools/patman/checkpatch.py
@@ -20,8 +20,8 @@ RE_FILE = re.compile(r'#(\d+): (FILE: ([^:]*):(\d+):)?')
RE_NOTE = re.compile(r'NOTE: (.*)')
-def FindCheckPatch():
- top_level = gitutil.GetTopLevel()
+def find_check_patch():
+ top_level = gitutil.get_top_level()
try_list = [
os.getcwd(),
os.path.join(os.getcwd(), '..', '..'),
@@ -47,7 +47,7 @@ def FindCheckPatch():
'~/bin directory or use --no-check')
-def CheckPatchParseOneMessage(message):
+def check_patch_parse_one_message(message):
"""Parse one checkpatch message
Args:
@@ -114,7 +114,7 @@ def CheckPatchParseOneMessage(message):
return item
-def CheckPatchParse(checkpatch_output, verbose=False):
+def check_patch_parse(checkpatch_output, verbose=False):
"""Parse checkpatch.pl output
Args:
@@ -179,14 +179,14 @@ def CheckPatchParse(checkpatch_output, verbose=False):
elif re_bad.match(message):
result.ok = False
else:
- problem = CheckPatchParseOneMessage(message)
+ problem = check_patch_parse_one_message(message)
if problem:
result.problems.append(problem)
return result
-def CheckPatch(fname, verbose=False, show_types=False):
+def check_patch(fname, verbose=False, show_types=False):
"""Run checkpatch.pl on a file and parse the results.
Args:
@@ -209,16 +209,16 @@ def CheckPatch(fname, verbose=False, show_types=False):
lines: Number of lines
stdout: Full output of checkpatch
"""
- chk = FindCheckPatch()
+ chk = find_check_patch()
args = [chk, '--no-tree']
if show_types:
args.append('--show-types')
- output = command.Output(*args, fname, raise_on_error=False)
+ output = command.output(*args, fname, raise_on_error=False)
- return CheckPatchParse(output, verbose)
+ return check_patch_parse(output, verbose)
-def GetWarningMsg(col, msg_type, fname, line, msg):
+def get_warning_msg(col, msg_type, fname, line, msg):
'''Create a message for a given file/line
Args:
@@ -228,33 +228,33 @@ def GetWarningMsg(col, msg_type, fname, line, msg):
msg: Message to report
'''
if msg_type == 'warning':
- msg_type = col.Color(col.YELLOW, msg_type)
+ msg_type = col.build(col.YELLOW, msg_type)
elif msg_type == 'error':
- msg_type = col.Color(col.RED, msg_type)
+ msg_type = col.build(col.RED, msg_type)
elif msg_type == 'check':
- msg_type = col.Color(col.MAGENTA, msg_type)
+ msg_type = col.build(col.MAGENTA, msg_type)
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):
+def check_patches(verbose, args):
'''Run the checkpatch.pl script on each patch'''
error_count, warning_count, check_count = 0, 0, 0
col = terminal.Color()
for fname in args:
- result = CheckPatch(fname, verbose)
+ result = check_patch(fname, verbose)
if not result.ok:
error_count += result.errors
warning_count += result.warnings
check_count += result.checks
print('%d errors, %d warnings, %d checks for %s:' % (result.errors,
- result.warnings, result.checks, col.Color(col.BLUE, fname)))
+ result.warnings, result.checks, col.build(col.BLUE, fname)))
if (len(result.problems) != result.errors + result.warnings +
result.checks):
print("Internal error: some problems lost")
for item in result.problems:
sys.stderr.write(
- GetWarningMsg(col, item.get('type', '<unknown>'),
+ get_warning_msg(col, item.get('type', '<unknown>'),
item.get('file', '<unknown>'),
item.get('line', 0), item.get('msg', 'message')))
print
@@ -266,6 +266,6 @@ def CheckPatches(verbose, args):
color = col.YELLOW
if error_count:
color = col.RED
- print(col.Color(color, str % (error_count, warning_count, check_count)))
+ print(col.build(color, str % (error_count, warning_count, check_count)))
return False
return True