File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 14
14
# turn-around
15
15
16
16
set -e
17
+ # pipefail is necessary to propagate exit codes
18
+ set -o pipefail
17
19
18
20
PROJECT=scikit-learn/scikit-learn
19
21
PROJECT_URL=https://github.com/$PROJECT .git
@@ -79,7 +81,20 @@ echo -e '\nRunning flake8 on the diff in the range'\
79
81
" ($( git rev-list $COMMIT .. | wc -l) commit(s)):"
80
82
echo ' --------------------------------------------------------------------------------'
81
83
82
- # Conservative approach: diff without context so that code that was
83
- # not changed does not create failures
84
- git diff --unified=0 $COMMIT | flake8 --diff --show-source
84
+ # We ignore files from sklearn/externals. Unfortunately there is no
85
+ # way to do it with flake8 directly (the --exclude does not seem to
86
+ # work with --diff). We could use the exclude magic in the git pathspec
87
+ # ':!sklearn/externals' but it is only available on git 1.9 and Travis
88
+ # uses git 1.8.
89
+ # We need the following command to exit with 0 hence the echo in case
90
+ # there is no match
91
+ MODIFIED_FILES=$( git diff --name-only $COMMIT | grep -v ' sklearn/externals' || echo " no_match" )
92
+
93
+ if [[ " $MODIFIED_FILES " == " no_match" ]]; then
94
+ echo " No file outside sklearn/externals has been modified"
95
+ else
96
+ # Conservative approach: diff without context so that code that
97
+ # was not changed does not create failures
98
+ git diff --unified=0 $COMMIT -- $MODIFIED_FILES | flake8 --diff --show-source
99
+ fi
85
100
echo -e " No problem detected by flake8\n"
You can’t perform that action at this time.
0 commit comments