build: update clang-format script (#34480)

* build: fix clang-format script

* chore: remove python2 cases

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2022-06-09 11:13:54 +09:00
committed by GitHub
parent def1ec7f99
commit e87d17b728
3 changed files with 59 additions and 31 deletions

View File

@@ -70,9 +70,9 @@ const LINTERS = [{
test: filename => filename.endsWith('.cc') || (filename.endsWith('.h') && !isObjCHeader(filename)),
run: (opts, filenames) => {
if (opts.fix) {
spawnAndCheckExitCode('python', ['script/run-clang-format.py', '--fix', ...filenames]);
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', '--fix', ...filenames]);
} else {
spawnAndCheckExitCode('python', ['script/run-clang-format.py', ...filenames]);
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', ...filenames]);
}
cpplint(filenames);
}
@@ -82,9 +82,9 @@ const LINTERS = [{
test: filename => filename.endsWith('.mm') || (filename.endsWith('.h') && isObjCHeader(filename)),
run: (opts, filenames) => {
if (opts.fix) {
spawnAndCheckExitCode('python', ['script/run-clang-format.py', '--fix', ...filenames]);
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', '--fix', ...filenames]);
} else {
spawnAndCheckExitCode('python', ['script/run-clang-format.py', ...filenames]);
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', ...filenames]);
}
const filter = [
'-readability/braces',