diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:20:02 +0000 |
commit | 58daab21cd043e1dc37024a7f99b396788372918 (patch) | |
tree | 96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /fluent-bit/lib/jansson-e23f558/scripts/clang-format-check | |
parent | Releasing debian version 1.43.2-1. (diff) | |
download | netdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz netdata-58daab21cd043e1dc37024a7f99b396788372918.zip |
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/lib/jansson-e23f558/scripts/clang-format-check')
-rwxr-xr-x | fluent-bit/lib/jansson-e23f558/scripts/clang-format-check | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/fluent-bit/lib/jansson-e23f558/scripts/clang-format-check b/fluent-bit/lib/jansson-e23f558/scripts/clang-format-check new file mode 100755 index 00000000..983e55d9 --- /dev/null +++ b/fluent-bit/lib/jansson-e23f558/scripts/clang-format-check @@ -0,0 +1,27 @@ +#!/bin/bash + +CLANG_FORMAT=${CLANG_FORMAT:-clang-format} +CLANG_FORMAT_VERSION=${CLANG_FORMAT_VERSION:-} + +if ! type $CLANG_FORMAT >/dev/null || \ + ! $CLANG_FORMAT --version | grep -q "version ${CLANG_FORMAT_VERSION}"; then + # If running tests, mark this test as skipped. + exit 77 +fi + +errors=0 +paths=$(git ls-files | grep '\.[ch]$') +for path in $paths; do + in=$(cat $path) + out=$($CLANG_FORMAT $path) + + if [ "$in" != "$out" ]; then + diff -u -L $path -L "$path.formatted" $path - <<<$out + errors=1 + fi +done + +if [ $errors -ne 0 ]; then + echo "Formatting errors detected, run ./scripts/clang-format to fix!" + exit 1 +fi |