@@ -99,14 +99,6 @@ time {
99
99
xargs -0 awk -f " ci/check-include-guards.gawk"
100
100
}
101
101
102
- # Apply cmake_format to all the CMake list files.
103
- # https://github.com/cheshirekow/cmake_format
104
- printf " %-30s" " Running cmake-format:" >&2
105
- time {
106
- git ls-files -z | grep -zE ' ((^|/)CMakeLists\.txt|\.cmake)$' |
107
- xargs -P " $( nproc) " -n 1 -0 cmake-format -i
108
- }
109
-
110
102
# TODO(#4501) - this fixup can be removed if #include <absl/...> works
111
103
# Apply transformations to fix errors on MSVC+x86. See the bug for a detailed
112
104
# explanation as to why this is needed:
@@ -123,13 +115,28 @@ time {
123
115
xargs -P " $( nproc) " -n 50 -0 bash -c " sed_edit ${expressions[*]} \"\$ 0\" \"\$ @\" "
124
116
}
125
117
126
- # Apply clang-format(1) to fix whitespace and other formatting rules.
127
- # The version of clang-format is important, different versions have slightly
128
- # different formatting output (sigh).
129
- printf " %-30s" " Running clang-format:" >&2
118
+ # Apply several transformations that cannot be enforced by clang-format:
119
+ # - Replace any #include for grpc++/* with grpcpp/*. The paths with grpc++
120
+ # are obsoleted by the gRPC team, so we should not use them in our code.
121
+ # - Replace grpc::<BLAH> with grpc::StatusCode::<BLAH>, the aliases in the
122
+ # `grpc::` namespace do not exist inside google.
123
+ printf " %-30s" " Running include fixes:" >&2
130
124
time {
125
+ expressions=(" -e" " 's/grpc::\([A-Z][A-Z_]\+\)/grpc::StatusCode::\1/g'" )
126
+ expressions+=(" -e" " 's;#include <grpc++/grpc++.h>;#include <grpcpp/grpcpp.h>;'" )
127
+ expressions+=(" -e" " 's;#include <grpc++/;#include <grpcpp/;'" )
131
128
git ls-files -z | grep -zE ' \.(cc|h)$' |
132
- xargs -P " $( nproc) " -n 50 -0 clang-format -i
129
+ xargs -P " $( nproc) " -n 50 -0 bash -c " sed_edit ${expressions[*]} \"\$ 0\" \"\$ @\" "
130
+ }
131
+
132
+ # Apply transformations to fix whitespace formatting in files not handled by
133
+ # clang-format(1) above. For now we simply remove trailing blanks. Note that
134
+ # we do not expand TABs (they currently only appear in Makefiles and Makefile
135
+ # snippets).
136
+ printf " %-30s" " Running whitespace fixes:" >&2
137
+ time {
138
+ git ls-files -z | grep -zv ' \.gz$' |
139
+ xargs -P " $( nproc) " -n 50 -0 bash -c " sed_edit -e 's/[[:blank:]]\+$//' \"\$ 0\" \"\$ @\" "
133
140
}
134
141
135
142
# Apply buildifier to fix the BUILD and .bzl formatting rules.
@@ -158,36 +165,28 @@ time {
158
165
printf " %-30s" " Running shellcheck:" >&2
159
166
time {
160
167
git ls-files -z | grep -z ' \.sh$' |
161
- xargs -0 shellcheck \
168
+ xargs -P " $( nproc ) " -n 1 - 0 shellcheck \
162
169
--exclude=SC1090 \
163
170
--exclude=SC1091 \
164
171
--exclude=SC2034 \
165
172
--exclude=SC2153 \
166
173
--exclude=SC2181
167
174
}
168
175
169
- # Apply several transformations that cannot be enforced by clang-format:
170
- # - Replace any #include for grpc++/* with grpcpp/*. The paths with grpc++
171
- # are obsoleted by the gRPC team, so we should not use them in our code.
172
- # - Replace grpc::<BLAH> with grpc::StatusCode::<BLAH>, the aliases in the
173
- # `grpc::` namespace do not exist inside google.
174
- printf " %-30s" " Running include fixes:" >&2
176
+ # The version of clang-format is important, different versions have slightly
177
+ # different formatting output (sigh).
178
+ printf " %-30s" " Running clang-format:" >&2
175
179
time {
176
- expressions=(" -e" " 's/grpc::\([A-Z][A-Z_]\+\)/grpc::StatusCode::\1/g'" )
177
- expressions+=(" -e" " 's;#include <grpc++/grpc++.h>;#include <grpcpp/grpcpp.h>;'" )
178
- expressions+=(" -e" " 's;#include <grpc++/;#include <grpcpp/;'" )
179
180
git ls-files -z | grep -zE ' \.(cc|h)$' |
180
- xargs -P " $( nproc) " -n 50 -0 bash -c " sed_edit ${expressions[*]} \"\$ 0 \" \"\$ @ \" "
181
+ xargs -P " $( nproc) " -n 1 -0 clang-format -i
181
182
}
182
183
183
- # Apply transformations to fix whitespace formatting in files not handled by
184
- # clang-format(1) above. For now we simply remove trailing blanks. Note that
185
- # we do not expand TABs (they currently only appear in Makefiles and Makefile
186
- # snippets).
187
- printf " %-30s" " Running whitespace fixes:" >&2
184
+ # Apply cmake_format to all the CMake list files.
185
+ # https://github.com/cheshirekow/cmake_format
186
+ printf " %-30s" " Running cmake-format:" >&2
188
187
time {
189
- git ls-files -z | grep -zv ' \.gz $' |
190
- xargs -P " $( nproc) " -n 50 -0 bash -c " sed_edit -e 's/[[:blank:]]\+$//' \"\$ 0 \" \"\$ @ \" "
188
+ git ls-files -z | grep -zE ' ((^|/)CMakeLists\.txt|\.cmake) $' |
189
+ xargs -P " $( nproc) " -n 1 -0 cmake-format -i
191
190
}
192
191
193
192
# Report the differences, which should break the build.
0 commit comments