| 1 | #!/bin/bash |
| 2 | |
| 3 | # link this file in your git-hooks, for example with: |
| 4 | # ln .git/hooks/pre-commit pre-commit |
| 5 | |
| 6 | if ./scripts/format.sh check |
| 7 | then |
| 8 | echo "nothing to format" |
| 9 | else |
| 10 | echo "unformatted files, please format and stage again" >&2 |
| 11 | exit 1 |
| 12 | fi |
| 13 | |
| 14 | if lizard include lib app test &> "/dev/null"; then |
| 15 | echo "no overcomplicated functions found" |
| 16 | else |
| 17 | echo "lizard-warnings found... aborting" >&2 |
| 18 | exit 1 |
| 19 | fi |
| 20 | |
| 21 | cd "build/debug" |
| 22 | if ninja ;then |
| 23 | echo "debug-build successfull" |
| 24 | else |
| 25 | echo "build-failure... aborting" >&2 |
| 26 | exit 2 |
| 27 | fi |
| 28 | cd "../.." |
| 29 | |
| 30 | cd "build/debug" |
| 31 | if ninja test &> "/dev/null";then |
| 32 | echo "unit-tests run succesfully" |
| 33 | else |
| 34 | echo "unit-tests failed... aborting" >&2 |
| 35 | exit 2 |
| 36 | fi |
| 37 | cd "../.." |