forked from pytorch/PiPPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.sh
executable file
·76 lines (58 loc) · 1.13 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
75
#!/bin/bash
function usage() {
echo 2>&1 <<EOF
USAGE: ./check [--keep-going] [--skip-pyre]
--keep-going (default: 0)
Continue processing even when errors are ecountered.
--skip-pyre
Don't run pyre checks.
--skip-format
Don't run format checks.
EOF
}
SKIP_FORMAT=0
SKIP_PYRE=0
KEEP_GOING=0
for x in "$@"; do
case "$x" in
'--keep-going')
KEEP_GOING=1
;;
'--skip-pyre')
SKIP_PYRE=1
;;
'--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 ..."
./format.sh --check
(( RETVAL |= $? ))
fi
if (( SKIP_PYRE == 0 )); then
echo; echo "Running pyre ..."
pyre check
(( RETVAL |= $? ))
fi
echo; echo "Running flake8 ..."
flake8 pippy spmd test/spmd
(( RETVAL |= $? ))
# mypy spmd test/spmd
echo; echo "Running mypy ..."
mypy spmd pippy
(( RETVAL |= $? ))
echo; echo "Running pylint ..."
pylint --disable=all --enable=unused-import $(git ls-files '*.py')
(( RETVAL |= $? ))
exit $RETVAL