forked from open-telemetry/opentelemetry-network
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclang-format.sh
More file actions
executable file
·37 lines (31 loc) · 885 Bytes
/
clang-format.sh
File metadata and controls
executable file
·37 lines (31 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
CLANG_FORMAT="clang-format-19"
if ! command -v ${CLANG_FORMAT}
then
echo "ERROR: requires ${CLANG_FORMAT}"
exit 1
fi
RC=0
CMD="${CLANG_FORMAT} -Werror -i -style=file"
function format_file
{
if ! ${CMD} $1
then
RC=1
fi
}
# Check that C and C++ source files are properly clang-formatted
FILES=$(find ./geoip ./reducer ./test ./collector/kernel ./common ./tools \
-type f \
\( -name "*.c" \
-o -name "*.cc" \
-o -name "*.h" \
-o -name "*.inl" \) \
-print)
for FILE in ${FILES}
do
format_file ${FILE}
done
exit ${RC}