mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 15:17:13 +02:00
Add Jansson vendor library.
This commit is contained in:
3
vendor/Jansson/scripts/clang-format
vendored
Normal file
3
vendor/Jansson/scripts/clang-format
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
find . -type f -a '(' -name '*.c' -o -name '*.h' ')' | xargs clang-format -i
|
27
vendor/Jansson/scripts/clang-format-check
vendored
Normal file
27
vendor/Jansson/scripts/clang-format-check
vendored
Normal file
@ -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
|
Reference in New Issue
Block a user