-
Notifications
You must be signed in to change notification settings - Fork 86
/
check.sh
executable file
·74 lines (57 loc) · 1.1 KB
/
check.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
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
function usage() {
echo 2>&1 <<EOF
USAGE: ./check [--keep-going] [--pyre]
--keep-going (default: 1)
Continue processing even when errors are ecountered.
--pyre
Run pyre checks.
--skip-format
Don't run format checks.
EOF
}
SKIP_FORMAT=0
SKIP_PYRE=1
KEEP_GOING=1
for x in "$@"; do
case "$x" in
'--keep-going')
KEEP_GOING=1
;;
'--pyre')
SKIP_PYRE=0
;;
'--skip-format')
SKIP_FORMAT=1
;;
*)
echo "Unknown option: $x" 2>&1
usage
exit 1;
;;
esac
done
if (( KEEP_GOING == 0 )); then
set -e
fi
RETVAL=0
if (( SKIP_FORMAT == 0 )); then
echo; echo "Running format check ..."
ufmt diff pippy/*.py test/*.py
(( RETVAL |= $? ))
fi
if (( SKIP_PYRE == 0 )); then
echo; echo "Running pyre ..."
pyre check
(( RETVAL |= $? ))
fi
echo; echo "Running flake8 ..."
flake8 pippy
(( RETVAL |= $? ))
echo; echo "Running mypy ..."
mypy --follow-imports=skip pippy
(( RETVAL |= $? ))
echo; echo "Running pylint ..."
pylint --disable=all --enable=unused-import $(git ls-files '*.py')
(( RETVAL |= $? ))
exit $RETVAL