From 605b58efb12358ee94f56009960ef75c26f4b94d Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 27 Aug 2021 18:41:10 +0300 Subject: utils: checkstyle.py: Use single-quoted strings when possible 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 --- utils/checkstyle.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'utils/checkstyle.py') diff --git a/utils/checkstyle.py b/utils/checkstyle.py index ececb46e..835f2a9f 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 -- cgit v1.2.1