-
Notifications
You must be signed in to change notification settings - Fork 3
/
dev.sh
executable file
·61 lines (49 loc) · 1.04 KB
/
dev.sh
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
#!/bin/bash
set -eu
run_linters() {
set +e
echo "Running flake8 ..."
flake8_output=$(flake8 --config .flake8 --statistics src/)
if [ $? -ne 0 ]; then echo "$flake8_output"; else echo " Success!"; fi
echo "Running mypy ..."
mypy_output=$(mypy --config-file .mypy.ini src/)
if [ $? -ne 0 ]; then echo "$mypy_output"; else echo " Success!"; fi
echo "Running pylint ..."
pylint_output=$(pylint --rcfile .pylintrc src/)
if [ $? -ne 0 ]; then echo "$pylint_output"; else echo " Success!"; fi
}
run_unit_tests() {
pytest tests/unit
}
run_help() {
cat <<EOF
usage:
./dev.sh <command>
commands:
lint runs linters
unit runs unit tests
help shows this help
EOF
}
if [ $# -ne 1 ]; then
echo -e "No arguments were supplied\n"
run_help
exit 1
fi
command="$1"
shift
case "$command" in
lint)
run_linters
;;
unit)
run_unit_tests
;;
help)
run_help
;;
*)
echo -e "Invalid command: $command\n"
run_help
;;
esac