From patchwork Fri Aug 27 15:43:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13558 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4C88ABD87C for ; Fri, 27 Aug 2021 15:43:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 731056891F; Fri, 27 Aug 2021 17:43:27 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="gF9WB6dG"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DA11860256 for ; Fri, 27 Aug 2021 17:43:26 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5325D499 for ; Fri, 27 Aug 2021 17:43:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1630079006; bh=WuZCwHmsA19/7aarEb905U9MTVEoVWOOnI7H+L910us=; h=From:To:Subject:Date:From; b=gF9WB6dG45WV6Z8h6q8xwqkuJddwRIka0uvNtaK7Il5cw1fJpN4tRbz5hrOog/EOm XdIoJMnGwsDTVbl3tVxS4yPiGiQEL4GRyhBtOgm6bT0HdQ2Ses4KhQIh2P+Qgu/1kr 167R1ZwRV6E8OZiFVLfPuGJmxmY5sAVdDFZJYTSk= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 27 Aug 2021 18:43:09 +0300 Message-Id: <20210827154309.16367-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] utils: checkstyle.py: Use single-quoted strings when possible X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" checkstyle.py uses single-quoted strings in most locations already. There are a few locations where this wouldn't be convenient (when the string itself contains a single quote, which would then require escaping), but there are also a few other locations where double quotes are used when single quotes would work fine. Change those to standardize on single-quoted strings. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain --- utils/checkstyle.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/utils/checkstyle.py b/utils/checkstyle.py index ececb46eaacc..835f2a9fcd71 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -239,7 +239,7 @@ class StagedChanges(Commit): def _parse(self): ret = subprocess.run(['git', 'diff', '--staged', '--name-status'], stdout=subprocess.PIPE).stdout.decode('utf-8') - self._title = "Staged changes" + self._title = 'Staged changes' self._files = [CommitFile(f) for f in ret.splitlines()] def get_diff(self, top_level, filename): @@ -476,7 +476,7 @@ class Pep8Checker(StyleChecker): ret = subprocess.run(['pycodestyle', '--ignore=E501', '-'], input=data, stdout=subprocess.PIPE) except FileNotFoundError: - issues.append(StyleIssue(0, None, "Please install pycodestyle to validate python additions")) + issues.append(StyleIssue(0, None, 'Please install pycodestyle to validate python additions')) return issues results = ret.stdout.decode('utf-8').splitlines() @@ -509,7 +509,7 @@ class ShellChecker(StyleChecker): ret = subprocess.run(['shellcheck', '-Cnever', '-'], input=data, stdout=subprocess.PIPE) except FileNotFoundError: - issues.append(StyleIssue(0, None, "Please install shellcheck to validate shell script additions")) + issues.append(StyleIssue(0, None, 'Please install shellcheck to validate shell script additions')) return issues results = ret.stdout.decode('utf-8').splitlines() @@ -774,10 +774,10 @@ def check_style(top_level, commit): issues += check_file(top_level, commit, f) if issues == 0: - print("No issue detected") + print('No issue detected') else: print('---') - print("%u potential %s detected, please review" % + print('%u potential %s detected, please review' % (issues, 'issue' if issues == 1 else 'issues')) return issues @@ -833,7 +833,7 @@ def main(argv): for command, mandatory in dependencies.items(): found = shutil.which(command) if mandatory and not found: - print("Executable %s not found" % command) + print('Executable %s not found' % command) return 1 dependencies[command] = found