Skip to content

Commit d48b257

Browse files
authored
Merge pull request statsmodels#4929 from bashtage/add-flake-new-files
MAINT/BLD: Add linting for any new files
2 parents 1e3a76f + 0c283c5 commit d48b257

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lint.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ echo "inside $0"
44

55
RET=0
66

7-
if [ "$LINT" = true ]; then
7+
if [ "$LINT" == true ]; then
8+
echo "Linting all files with limited rules"
89
flake8 statsmodels
910
if [ $? -ne "0" ]; then
1011
RET=1
1112
fi
1213

1314
# Run with --isolated to ignore config files, the files included here
1415
# pass _all_ flake8 checks
16+
echo "Linting known clean files with strict rules"
1517
flake8 --isolated \
1618
statsmodels/info.py \
1719
statsmodels/resampling/ \
@@ -24,6 +26,15 @@ if [ "$LINT" = true ]; then
2426
RET=1
2527
fi
2628

29+
# Tests any new python files
30+
NEW_FILES=$(git diff master --name-status -u -- "*.py" | grep ^A | cut -c 3- | paste -sd " " -)
31+
if [ -n "$NEW_FILES" ]; then
32+
echo "Linting newly added files with strict rules"
33+
flake8 --isolated $(eval echo $NEW_FILES)
34+
if [ $? -ne "0" ]; then
35+
RET=1
36+
fi
37+
fi
2738
fi
2839

2940
exit $RET

0 commit comments

Comments
 (0)