Fix infra/specs/PRESUBMIT.py to not concatenate list to str

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 <daniel.l@hpcnt.com>
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38831}
This commit is contained in:
Byoungchan Lee 2022-12-06 21:34:35 +09:00 committed by WebRTC LUCI CQ
parent e4caacbfc3
commit 7970f87a37

View File

@ -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'