[libcamera-devel] [PATCH] utils: checkstyle.py: Use single-quoted strings when possible
Umang Jain
umang.jain at ideasonboard.com
Mon Aug 30 12:22:36 CEST 2021
Hi Laurent,
On 8/27/21 9:13 PM, Laurent Pinchart wrote:
> 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 <laurent.pinchart at ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
> ---
> 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
More information about the libcamera-devel
mailing list