]>
git.ipfire.org Git - thirdparty/pdns.git/blob - build-scripts/format-code
4 # Reformat code, but do not touch if no changes.
7 if [ "$0" != "./build-scripts/format-code" -a "$0" != "build-scripts/format-code" ]; then
8 echo "Please run me from the root checkout dir"
13 echo usage
: $0 file...
15 echo format C
++ files
, does not
touch non-regular files
18 if [ ! -e .clang-format
]; then
19 echo "No .clang-format file found in .";
27 if [ x
$CIRCLECI = xtrue
]; then
31 for file in "${@}"; do
32 if [ -h "$file" -o ! -f "$file" ]; then
33 if [ $verbose = 1 ]; then
34 echo "$file: skipped, not a regular file or unreadable"
38 tmp
=$
(mktemp
"$file.XXXXXXXX")
39 if ! clang-format
-style=file "$file" > "$tmp"; then
42 if ! cmp -s "$file" "$tmp"; then
43 echo "$file: reformatted"
46 if [ $verbose = 1 ]; then
47 echo "$file: already formatted to perfection"