From d98006997c342435f906317758292fe97c520b47 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 29 Jan 2022 14:14:05 -0700 Subject: patman: Convert camel case in command.py Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass --- tools/patman/checkpatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/patman/checkpatch.py') diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 8978df25c15..4677a7ae214 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -213,7 +213,7 @@ def CheckPatch(fname, verbose=False, show_types=False): 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) -- cgit v1.2.3 From ae5e9265509bcb4bed7a0a1c3da613419919681d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 29 Jan 2022 14:14:06 -0700 Subject: patman: Convert camel case in checkpatch.py Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass --- tools/patman/checkpatch.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tools/patman/checkpatch.py') diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 4677a7ae214..e1321abd3c8 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -20,7 +20,7 @@ RE_FILE = re.compile(r'#(\d+): (FILE: ([^:]*):(\d+):)?') RE_NOTE = re.compile(r'NOTE: (.*)') -def FindCheckPatch(): +def find_check_patch(): top_level = gitutil.GetTopLevel() try_list = [ 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) - 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: @@ -236,13 +236,13 @@ def GetWarningMsg(col, msg_type, fname, line, 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): +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 @@ -254,7 +254,7 @@ def CheckPatches(verbose, args): print("Internal error: some problems lost") for item in result.problems: sys.stderr.write( - GetWarningMsg(col, item.get('type', ''), + get_warning_msg(col, item.get('type', ''), item.get('file', ''), item.get('line', 0), item.get('msg', 'message'))) print -- cgit v1.2.3 From 0157b187f45c00ffb3e85c7f5c33808454243608 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 29 Jan 2022 14:14:11 -0700 Subject: patman: Convert camel case in gitutil.py Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass --- tools/patman/checkpatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/patman/checkpatch.py') diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index e1321abd3c8..043419089a8 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -21,7 +21,7 @@ RE_NOTE = re.compile(r'NOTE: (.*)') def find_check_patch(): - top_level = gitutil.GetTopLevel() + top_level = gitutil.get_top_level() try_list = [ os.getcwd(), os.path.join(os.getcwd(), '..', '..'), -- cgit v1.2.3 From 252ac589969acbc4c17379a4e862a18e1518d12d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 29 Jan 2022 14:14:17 -0700 Subject: patman: Rename Color() method to build() This method has the same name as its class which is confusing. It is also annoying when searching the code. It builds a string with a colour, so rename it to build(). Signed-off-by: Simon Glass --- tools/patman/checkpatch.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tools/patman/checkpatch.py') diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 043419089a8..dd792efee0b 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -228,11 +228,11 @@ def get_warning_msg(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) @@ -248,7 +248,7 @@ def check_patches(verbose, args): 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") @@ -266,6 +266,6 @@ def check_patches(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 -- cgit v1.2.3