git repos / blockattack-game

blame: source/misc/lint/runLint.sh

normal view · raw

037887fa Poul Sander 2016-11-24 21:24 1
#! /bin/bash
037887fa Poul Sander 2016-11-24 21:24 2
set -euo pipefail
037887fa Poul Sander 2016-11-24 21:24 3
037887fa Poul Sander 2016-11-24 21:24 4
TMPFILE=$(mktemp /tmp/sago-lint.XXXXXX)
037887fa Poul Sander 2016-11-24 21:24 5
037887fa Poul Sander 2016-11-24 21:24 6
find ./source/code/ -name "*.cpp" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number "^  " >> ${TMPFILE}  || true
037887fa Poul Sander 2016-11-24 21:24 7
find ./source/code/ -name "*.h*" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number "^  " >> ${TMPFILE}  || true
037887fa Poul Sander 2016-11-24 21:24 8
037887fa Poul Sander 2016-11-24 21:24 9
if [ -s "$TMPFILE" ]
037887fa Poul Sander 2016-11-24 21:24 10
then 
037887fa Poul Sander 2016-11-24 21:24 11
echo "In the following places the lines are indended with spaces. This project uses tabs for indentation."
037887fa Poul Sander 2016-11-24 21:24 12
echo "The rule applies to comments too although the check can be bypassed by using either C++ style comments or \" *\" to start a line (Doxygen comments)"
037887fa Poul Sander 2016-11-24 21:24 13
cat "$TMPFILE"
037887fa Poul Sander 2016-11-24 21:24 14
echo ""
037887fa Poul Sander 2016-11-24 21:24 15
echo "Validation failed"
037887fa Poul Sander 2016-11-24 21:24 16
rm "$TMPFILE"
037887fa Poul Sander 2016-11-24 21:24 17
exit 1
037887fa Poul Sander 2016-11-24 21:24 18
fi
037887fa Poul Sander 2016-11-24 21:24 19
037887fa Poul Sander 2016-11-24 21:24 20
rm "$TMPFILE"
1970-01-01 00:00 21