aboutsummaryrefslogtreecommitdiff
path: root/check
blob: 1983f5dcb92ddf15029bddeca2cf4cadc9493430 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/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"
        KERBANA_CONFIG=kerbana_tests.yaml ./manage.py test $@
        cd -
        ;;
    "coverage")
        cd "$root"
        KERBANA_CONFIG=kerbana_tests.yaml 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