Luna/tools/check-formatting.sh

28 lines
439 B
Bash
Raw Normal View History

#!/usr/bin/env bash
source $(dirname $0)/env.sh
cd $LUNA_ROOT
2022-11-16 16:37:18 +00:00
SOURCES=($(find kernel/src -type f | grep -v "\.asm"))
SOURCES+=($(find luna -type f | grep -v "CMakeLists.txt"))
ALL_OK=1
for f in ${SOURCES[@]}
do
clang-format -n $f 2>&1 | grep ".*" >/dev/null
if [ "$?" = "0" ]
then
echo "File $f needs formatting"
ALL_OK=0
fi
done
if [ $ALL_OK = "1" ]
then
echo "All files OK"
exit 0
fi
exit 1