| 1 | #! /bin/bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | TMPFILE=$(mktemp /tmp/sago-lint.XXXXXX) |
| 5 | |
| 6 | find ./source/code/ -name "*.cpp" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number "^ " >> ${TMPFILE} || true |
| 7 | find ./source/code/ -name "*.h*" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number "^ " >> ${TMPFILE} || true |
| 8 | |
| 9 | if [ -s "$TMPFILE" ] |
| 10 | then |
| 11 | echo "In the following places the lines are indended with spaces. This project uses tabs for indentation." |
| 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)" |
| 13 | cat "$TMPFILE" |
| 14 | echo "" |
| 15 | echo "Validation failed" |
| 16 | rm "$TMPFILE" |
| 17 | exit 1 |
| 18 | fi |
| 19 | |
| 20 | rm "$TMPFILE" |