Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E68D5C433F5 for ; Sat, 29 Jan 2022 21:15:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 25B9C83678; Sat, 29 Jan 2022 22:14:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="M+O+1oUr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CDB16836C4; Sat, 29 Jan 2022 22:14:43 +0100 (CET) Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 63A7783686 for ; Sat, 29 Jan 2022 22:14:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2f.google.com with SMTP id i62so12076419ioa.1 for ; Sat, 29 Jan 2022 13:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mZ/MIWnLPmwgr60FO9HSX0D3YFuSHimbBunqNZTS7DQ=; b=M+O+1oUrNCTRFB0DruvE5lzLrelTjJkiU4ZE7wDE2OZfVDsgbL2iyqs6l3snxMH2cv aYKGr/qfDuHi6K7AE6CUfLl8we1Ns1KZAomw/mSUmr2jgkDfqEVzmvGv+7sQdamSoMa0 X2Twe89PgBf0SIA2l1bF2kIXeY8O4HzgmUii0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mZ/MIWnLPmwgr60FO9HSX0D3YFuSHimbBunqNZTS7DQ=; b=uq+RXfgBSILAuW+f2LKFP0GLFgP/flNXSV9F1mLqHzlcIkMz+xIKSNU65DSW9iHUqc rvvVRzzsBxeWv21fyALULb7kDDf2Wbf/qAJX1BnmQKMgYgZwu/+KCm3uY2cvxWsEtNOq zMJcaGfAc/eh9FE7qu7bRUwt8ZR2XcGOAl4+yUxkbQ3lpJF7pSKgniJyAfJdqUAJBZZe XxR4neQxgkV0YrlP6o+zqPAYW8GvX40fVNUmGqrxxLzqa8oicqlH4+t9pWk5lNfeVoCm NeHuHN5PDKjdBjKA4hvmXlD5hWdPHFkLviUFc+YOyfgsUm1HURlvCFpUTdR66dA9k24V MuvA== X-Gm-Message-State: AOAM5338FZCBYu0cY55OnyFsX4pOA4NBF3YNbz5o9Gt2e02j/jdODCzW ohXRWQhZyumOC/uQomTky8Y96yYbaHiKlg== X-Google-Smtp-Source: ABdhPJyCBE/aITeo8faskMjqWbLalRD+fQiwt6VncDAU7ahPRDqmif/Qcd/64kILL7/0HJXNHxRJ2Q== X-Received: by 2002:a02:9713:: with SMTP id x19mr7655402jai.154.1643490874395; Sat, 29 Jan 2022 13:14:34 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c3sm17218110iow.28.2022.01.29.13.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jan 2022 13:14:34 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Tom Rini , Simon Glass Subject: [PATCH 03/17] patman: Convert camel case in checkpatch.py Date: Sat, 29 Jan 2022 14:14:06 -0700 Message-Id: <20220129211420.528117-4-sjg@chromium.org> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220129211420.528117-1-sjg@chromium.org> References: <20220129211420.528117-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass --- tools/patman/checkpatch.py | 22 +++++++++++----------- tools/patman/control.py | 2 +- tools/patman/test_checkpatch.py | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) 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 diff --git a/tools/patman/control.py b/tools/patman/control.py index ee9717cbf62..a19b17170af 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -86,7 +86,7 @@ def check_patches(series, patch_files, run_checkpatch, verbose): # Check the patches, and run them through 'git am' just to be sure if run_checkpatch: - ok = checkpatch.CheckPatches(verbose, patch_files) + ok = checkpatch.check_patches(verbose, patch_files) else: ok = True return ok diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py index 56af5265cc8..cf6cb713b76 100644 --- a/tools/patman/test_checkpatch.py +++ b/tools/patman/test_checkpatch.py @@ -82,7 +82,7 @@ Signed-off-by: Simon Glass return inname def run_checkpatch(self): - return checkpatch.CheckPatch(self.get_patch(), show_types=True) + return checkpatch.check_patch(self.get_patch(), show_types=True) class TestPatch(unittest.TestCase): @@ -295,7 +295,7 @@ index 0000000..2234c87 def testGood(self): """Test checkpatch operation""" inf = self.SetupData('good') - result = checkpatch.CheckPatch(inf) + result = checkpatch.check_patch(inf) self.assertEqual(result.ok, True) self.assertEqual(result.problems, []) self.assertEqual(result.errors, 0) @@ -306,7 +306,7 @@ index 0000000..2234c87 def testNoSignoff(self): inf = self.SetupData('no-signoff') - result = checkpatch.CheckPatch(inf) + result = checkpatch.check_patch(inf) self.assertEqual(result.ok, False) self.assertEqual(len(result.problems), 1) self.assertEqual(result.errors, 1) @@ -317,7 +317,7 @@ index 0000000..2234c87 def testNoLicense(self): inf = self.SetupData('no-license') - result = checkpatch.CheckPatch(inf) + result = checkpatch.check_patch(inf) self.assertEqual(result.ok, False) self.assertEqual(len(result.problems), 1) self.assertEqual(result.errors, 0) @@ -328,7 +328,7 @@ index 0000000..2234c87 def testSpaces(self): inf = self.SetupData('spaces') - result = checkpatch.CheckPatch(inf) + result = checkpatch.check_patch(inf) self.assertEqual(result.ok, False) self.assertEqual(len(result.problems), 3) self.assertEqual(result.errors, 0) @@ -339,7 +339,7 @@ index 0000000..2234c87 def testIndent(self): inf = self.SetupData('indent') - result = checkpatch.CheckPatch(inf) + result = checkpatch.check_patch(inf) self.assertEqual(result.ok, False) self.assertEqual(len(result.problems), 1) self.assertEqual(result.errors, 0) -- 2.35.0.rc2.247.g8bbb082509-goog