Luna/tools/check-formatting.sh

32 lines
452 B
Bash
Raw Normal View History

#!/usr/bin/env bash
source $(dirname $0)/env.sh
cd $LUNA_ROOT
source tools/sources.sh
ALL_OK=1
for f in ${SOURCES[@]}
do
2024-12-23 22:10:11 +00:00
clang-format -n $f 2>&1 | tee -a /tmp/clang-format-output | grep -q ^
2022-12-05 18:02:23 +00:00
RESULT=$?
2022-12-05 18:07:01 +00:00
if [ "$RESULT" -eq "0" ]
then
echo "File $f needs formatting"
ALL_OK=0
fi
done
if [ $ALL_OK = "1" ]
then
echo "All files OK"
exit 0
fi
2024-12-23 22:10:11 +00:00
cat /tmp/clang-format-output
rm /tmp/clang-format-output
exit 1