3 # Simple pre-commit hook to check that there are no errors in the fdroidserver
6 # Redirect output to stderr.
9 PY_FILES="fdroid makebuildserver setup.py examples/*.py buildserver/*.py fdroidserver/*.py"
10 SH_FILES="hooks/pre-commit"
11 BASH_FILES="fd-commit jenkins-build docs/update.sh"
12 RB_FILES="buildserver/cookbooks/*/recipes/*.rb"
20 command -v $1 1>/dev/null
23 if cmd_exists pyflakes-python2; then
24 PYFLAKES=pyflakes-python2
25 elif cmd_exists pyflakes; then
28 err "pyflakes is not installed!"
31 if cmd_exists pep8-python2; then
33 elif cmd_exists pep8; then
36 err "pep8 is not installed!"
39 if ! $PYFLAKES $PY_FILES; then
40 err "pyflakes tests failed!"
43 if ! $PEP8 --ignore=E123,E501 $PY_FILES; then
44 err "pep8 tests failed!"
48 for f in $SH_FILES; do
50 err "dash tests failed!"
54 for f in $BASH_FILES; do
56 err "bash tests failed!"
60 for f in $RB_FILES; do
61 if ! ruby -c $f 1>/dev/null; then
62 err "ruby tests failed!"