diff --git a/source/misc/lint/runLint.sh b/source/misc/lint/runLint.sh new file mode 100644 index 0000000..5e49ccf --- /dev/null +++ b/source/misc/lint/runLint.sh @@ -0,0 +1,20 @@ +#! /bin/bash +set -euo pipefail + +TMPFILE=$(mktemp /tmp/sago-lint.XXXXXX) + +find ./source/code/ -name "*.cpp" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number "^ " >> ${TMPFILE} || true +find ./source/code/ -name "*.h*" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number "^ " >> ${TMPFILE} || true + +if [ -s "$TMPFILE" ] +then +echo "In the following places the lines are indended with spaces. This project uses tabs for indentation." +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)" +cat "$TMPFILE" +echo "" +echo "Validation failed" +rm "$TMPFILE" +exit 1 +fi + +rm "$TMPFILE" diff --git a/travis_build.script b/travis_build.script index bab9ebe..37d83d4 100755 --- a/travis_build.script +++ b/travis_build.script @@ -1,5 +1,9 @@ #! /bin/bash set -e + +# First check for formatting errors +bash source/misc/lint/runLint.sh + # Travis runs Ubuntu 12.04 and misses libutfcpp-dev. cp source/misc/travis_help/utf8_v2_3_4/source/utf8.h source/code/ cp -r source/misc/travis_help/utf8_v2_3_4/source/utf8 source/code/