#!/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 --select=E,F,W,C90,E123 --ignore=W503 . 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 runserver cd - ;; *) echo "No such subcommand $SUBCMD" ;; esac