mirror of
https://github.com/shadps4-emu/ext-hwinfo.git
synced 2026-01-31 00:55:22 +01:00
29 lines
813 B
Bash
29 lines
813 B
Bash
#!/usr/bin/env bash
|
|
|
|
printf "Checking sources for code style\n"
|
|
SOURCE_FILES=()
|
|
find ./src/ ./test/ ./include/ -regextype egrep -regex '.*\.(h|c)(pp|xx)?$' -print0 > sourcelist
|
|
while IFS= read -r -d $'\0'; do
|
|
SOURCE_FILES+=("$REPLY")
|
|
done < sourcelist
|
|
|
|
ERROR=0
|
|
for source in "${SOURCE_FILES[@]}"; do
|
|
clang-format-14 -output-replacements-xml "$source" | grep "<replacement " &> /dev/null
|
|
HAS_WRONG_FILES=$?
|
|
if [ $HAS_WRONG_FILES -ne 1 ]; then
|
|
printf "Checking %s: \x1b[31mFAILED!\x1b[m\n" "$source"
|
|
ERROR=1
|
|
else
|
|
printf "Checking %s: \x1b[32mPASSED\x1b[m\n" "$source"
|
|
fi
|
|
done
|
|
|
|
rm sourcelist
|
|
|
|
if [ $ERROR -eq 0 ]; then
|
|
printf "\x1b[32mCongratulations! All sources match the code style\x1b[m\n"
|
|
else
|
|
printf "\x1b[31mclang-format-14 discovered style issues in at least one file.\x1b[m\n"
|
|
exit 1
|
|
fi |