9191printf " %-50s" " Running check-include-guards:" >&2
9292time {
9393 git_files -z -- ' *.h' |
94- xargs -r -0 awk -f " ci/check-include-guards.gawk"
94+ xargs -r -P " $( nproc ) " -n 50 - 0 awk -f " ci/check-include-guards.gawk"
9595}
9696
9797# TODO(#4501) - this fixup can be removed if #include <absl/...> works
@@ -103,8 +103,7 @@ time {
103103printf " %-50s" " Running Abseil header fixes:" >&2
104104time {
105105 expressions=(" -e" " 's;#include \" absl/strings/str_\(cat\|replace\|join\).h\" ;#include \" google/cloud/internal/absl_str_\1_quiet.h\" ;'" )
106- git_files -z -- ' *.h' ' *.cc' |
107- (grep -zv ' google/cloud/internal/absl_.*quiet.h$' || true) |
106+ (git grep -zEl ' #include "absl/strings/str_(cat|replace|join).h"' -- ' *.h' ' *.cc' ' :!google/cloud/internal/absl_str_*quiet.h' || true) |
108107 xargs -r -P " $( nproc) " -n 50 -0 bash -c " sed_edit ${expressions[*]} \"\$ 0\" \"\$ @\" "
109108}
110109
@@ -115,10 +114,13 @@ time {
115114# `grpc::` namespace do not exist inside google.
116115printf " %-50s" " Running include fixes:" >&2
117116time {
118- expressions=(" -e" " 's/grpc::\([A-Z][A-Z_]\+\)/grpc::StatusCode::\1/g'" )
119117 expressions+=(" -e" " 's;#include <grpc++/grpc++.h>;#include <grpcpp/grpcpp.h>;'" )
118+ (git grep -zEl ' grpc::([A-Z][A-Z_]+)' -- ' *.h' ' *.cc' || true) |
119+ xargs -r -P " $( nproc) " -n 50 -0 bash -c " sed_edit ${expressions[*]} \"\$ 0\" \"\$ @\" "
120+
121+ expression=(" -e" " 's;#include <grpc++/grpc++.h>;#include <grpcpp/grpcpp.h>;'" )
120122 expressions+=(" -e" " 's;#include <grpc++/;#include <grpcpp/;'" )
121- git_files -z -- ' *.h' ' *.cc' |
123+ (git grep -zl ' #include <grpc++/ ' -- ' *.h' ' *.cc' || true) |
122124 xargs -r -P " $( nproc) " -n 50 -0 bash -c " sed_edit ${expressions[*]} \"\$ 0\" \"\$ @\" "
123125}
124126
@@ -145,27 +147,27 @@ time {
145147printf " %-50s" " Running buildifier:" >&2
146148time {
147149 git_files -z -- ' *.BUILD' ' *.bzl' ' *.bazel' |
148- xargs -r -0 buildifier -mode=fix
150+ xargs -r -P " $( nproc ) " -n 50 - 0 buildifier -mode=fix
149151}
150152
151153# Apply psf/black to format Python files.
152154# https://pypi.org/project/black/
153155printf " %-50s" " Running black:" >&2
154156time {
155- git_files -z -- ' *.py' | xargs -r -0 python3 -m black --quiet
157+ git_files -z -- ' *.py' | xargs -r -P " $( nproc ) " -n 50 - 0 python3 -m black --quiet
156158}
157159
158160# Apply shfmt to format all shell scripts
159161printf " %-50s" " Running shfmt:" >&2
160162time {
161- git_files -z -- ' *.sh' | xargs -r -0 shfmt -w
163+ git_files -z -- ' *.sh' | xargs -r -P " $( nproc ) " -n 50 - 0 shfmt -w
162164}
163165
164166# Apply shellcheck(1) to emit warnings for common scripting mistakes.
165167printf " %-50s" " Running shellcheck:" >&2
166168time {
167169 git_files -z -- ' *.sh' |
168- xargs -r -P " $( nproc) " -n 1 -0 shellcheck \
170+ xargs -r -P " $( nproc) " -n 50 -0 shellcheck \
169171 --exclude=SC1090 \
170172 --exclude=SC1091 \
171173 --exclude=SC2034 \
@@ -178,15 +180,15 @@ time {
178180printf " %-50s" " Running clang-format:" >&2
179181time {
180182 git_files -z -- ' *.h' ' *.cc' ' *.proto' |
181- xargs -r -P " $( nproc) " -n 1 -0 clang-format -i
183+ xargs -r -P " $( nproc) " -n 50 -0 clang-format -i
182184}
183185
184186# Apply cmake_format to all the CMake list files.
185187# https://github.com/cheshirekow/cmake_format
186188printf " %-50s" " Running cmake-format:" >&2
187189time {
188190 git_files -z -- ' CMakeLists.txt' ' **/CMakeLists.txt' ' *.cmake' |
189- xargs -r -P " $( nproc) " -n 1 -0 cmake-format -i
191+ xargs -r -P " $( nproc) " -n 50 -0 cmake-format -i
190192}
191193
192194# The markdown generators run last. This is useful because as part of the
@@ -214,7 +216,7 @@ time {
214216printf " %-50s" " Running markdown formatter:" >&2
215217time {
216218 # See `.mdformat.toml` for the configuration parameters.
217- git_files -z -- ' *.md' | xargs -r -P " $( nproc) " -n 1 -0 mdformat
219+ git_files -z -- ' *.md' | xargs -r -P " $( nproc) " -n 50 -0 mdformat
218220 git_files -z -- ' *.md' | xargs -r -0 chmod go=u-w
219221}
220222
0 commit comments