mirror-chatterino2/tools/check-format.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
444 B
Bash
Raw Normal View History

2019-11-02 11:59:04 +01:00
#!/bin/bash
set -eu
fail="0"
clang-format --version
2019-11-02 11:59:04 +01:00
while read -r file; do
if ! diff -u <(cat "$file") <(clang-format "$file"); then
echo "$file differs!!!!!!!"
fail="1"
fi
done < <(find src/ -type f \( -iname "*.hpp" -o -iname "*.cpp" \))
2019-11-02 11:59:04 +01:00
if [ "$fail" = "1" ]; then
echo "At least one file is poorly formatted - check the output above"
exit 1
fi
echo "Everything seems to be formatted properly! Good job"