2015-09-23 08:52:44 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
readonly BASEDIR=$(readlink -f $(dirname $0))/..
|
|
|
|
cd $BASEDIR
|
|
|
|
|
|
|
|
# exit on errors
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if hash astyle; then
|
|
|
|
echo -n "Checking coding style..."
|
|
|
|
rm -f astyle.log
|
|
|
|
touch astyle.log
|
|
|
|
astyle --options=.astylerc "*.c" >> astyle.log
|
2016-05-11 14:10:45 -07:00
|
|
|
astyle --options=.astylerc "*.cpp" >> astyle.log
|
2015-09-23 08:52:44 -07:00
|
|
|
astyle --options=.astylerc "*.h" >> astyle.log
|
|
|
|
if grep -q "^Formatted" astyle.log; then
|
|
|
|
echo " errors detected"
|
2016-01-14 09:56:42 -07:00
|
|
|
git diff
|
2015-09-23 08:52:44 -07:00
|
|
|
sed -i -e 's/ / /g' astyle.log
|
|
|
|
grep --color=auto "^Formatted.*" astyle.log
|
|
|
|
echo "Incorrect code style detected in one or more files."
|
|
|
|
echo "The files have been automatically formatted."
|
|
|
|
echo "Remember to add the files to your commit."
|
|
|
|
rm -f astyle.log
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo " OK"
|
|
|
|
rm -f astyle.log
|
|
|
|
else
|
|
|
|
echo "You do not have astyle installed so your code style is not being checked!"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-03-25 09:19:16 -07:00
|
|
|
git grep -I -l -e . -z | \
|
2016-03-16 15:00:28 -07:00
|
|
|
xargs -0 -P8 -n1 scripts/eofnl
|
|
|
|
|
2015-09-23 08:52:44 -07:00
|
|
|
exit 0
|