#!/bin/sh set -e if [ $# -lt 1 ] then $0 coverage $0 typecheck $0 qa exit 0 fi root=$(readlink -f "$(dirname "$0")") # print deprecation warnings etc. export PYTHONDEVMODE=1 # ignore known warnings from third party libraries export PYTHONWARNINGS='default,ignore:::itypes,ignore:::^django[.]' SUBCMD=$1 shift 1 case $SUBCMD in "tests") cd "$root" ./manage.py test $@ cd - ;; "coverage") cd "$root" python3-coverage run ./manage.py test $@ python3-coverage report cd - ;; "qa") cd "$root" flake8 . isort --check-only --diff . if which doc8 then doc8 . fi cd - ;; "typecheck") cd "$root" mypy kerbana rrd cd - ;; "static") cd "$root" bandit --recursive --number=3 -lll -iii . cd - ;; "run") cd "$root" ./manage.py runserver cd - ;; "devdb") cd "$root" ./manage.py migrate ./manage.py createsuperuser --username admin --email admin@example.org cd - ;; *) echo "No such subcommand $SUBCMD" ;; esac