From 7970f87a37f0b7374029d0c711ee267afb568feb Mon Sep 17 00:00:00 2001 From: Byoungchan Lee Date: Tue, 6 Dec 2022 21:34:35 +0900 Subject: [PATCH] Fix infra/specs/PRESUBMIT.py to not concatenate list to str MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixing errors like this: Evaluation of CheckChangeOnCommit failed: can only concatenate str (not "list") to str, Traceback (most recent call last): ... File "/path/to/webrtc/src/infra/specs/PRESUBMIT.py", line 31, in CheckPatchFormatted results.append(output_api.PresubmitError('Error calling "' + cmd + '"')) TypeError: can only concatenate str (not "list") to str Bug: None Change-Id: Ia0b1c7a80a2752934c02d932a9206114769bcaa1 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/286547 Commit-Queue: Daniel.L (Byoungchan) Lee Reviewed-by: Jeremy Leconte Reviewed-by: Jeremy Leconte Reviewed-by: Björn Terelius Cr-Commit-Position: refs/heads/main@{#38831} --- infra/specs/PRESUBMIT.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/infra/specs/PRESUBMIT.py b/infra/specs/PRESUBMIT.py index 306a3f1952..f064cacaf8 100644 --- a/infra/specs/PRESUBMIT.py +++ b/infra/specs/PRESUBMIT.py @@ -9,6 +9,7 @@ # be found in the AUTHORS file in the root of the source tree. import os +import shlex # Runs PRESUBMIT.py in py3 mode by git cl presubmit. USE_PYTHON3 = True @@ -28,7 +29,8 @@ def CheckPatchFormatted(input_api, output_api): for f in affected_files: cmd = ['yapf', '-i', f.AbsoluteLocalPath()] if input_api.subprocess.call(cmd): - results.append(output_api.PresubmitError('Error calling "' + cmd + '"')) + results.append( + output_api.PresubmitError('Error calling "' + shlex.join(cmd) + '"')) if _HasLocalChanges(input_api): msg = ('Diff found after running "yapf -i" on modified .pyl files.\n'