-
Notifications
You must be signed in to change notification settings - Fork 1
/
lint.sh
executable file
·58 lines (52 loc) · 1.9 KB
/
lint.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
#!/bin/bash
echo "inside $0"
RET=0
if [ "$LINT" == true ]; then
echo "Linting all files with limited rules"
flake8 statsmodels
if [ $? -ne "0" ]; then
echo "Changed files failed linting using the required set of rules."
echo "Additions and changes must conform to Python code style rules."
RET=1
fi
# Run with --isolated to ignore config files, the files included here
# pass _all_ flake8 checks
echo "Linting known clean files with strict rules"
flake8 --isolated \
statsmodels/resampling/ \
statsmodels/interface/ \
statsmodels/duration/__init__.py \
statsmodels/gam/ \
statsmodels/graphics/tsaplots.py \
statsmodels/examples/tests/ \
statsmodels/iolib/smpickle.py \
statsmodels/regression/tests/test_lme.py \
statsmodels/tools/web.py \
statsmodels/tools/tests/test_linalg.py \
statsmodels/tools/decorators.py \
statsmodels/tools/tests/test_decorators.py \
statsmodels/tsa/base/tests/test_datetools.py \
statsmodels/tsa/vector_ar/dynamic.py \
statsmodels/tsa/statespace/tests/results/results_var_R.py \
statsmodels/tsa/statespace/tests/test_var.py \
statsmodels/conftest.py \
setup.py
if [ $? -ne "0" ]; then
echo "Previously passing files failed linting."
RET=1
fi
# Tests any new python files
git fetch --unshallow --quiet
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin --quiet
NEW_FILES=$(git diff origin/master --name-status -u -- "*.py" | grep ^A | cut -c 3- | paste -sd " " -)
if [ -n "$NEW_FILES" ]; then
echo "Linting newly added files with strict rules"
flake8 --isolated $(eval echo $NEW_FILES)
if [ $? -ne "0" ]; then
echo "New files failed linting."
RET=1
fi
fi
fi
exit $RET