File tree Expand file tree Collapse file tree 1 file changed +4
-24
lines changed
Expand file tree Collapse file tree 1 file changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -113,29 +113,9 @@ echo -e '\nRunning flake8 on the diff in the range' "$COMMIT_RANGE" \
113113 " ($( git rev-list $COMMIT_RANGE | wc -l) commit(s)):"
114114echo ' --------------------------------------------------------------------------------'
115115
116- # We ignore files from sklearn/externals. Unfortunately there is no
117- # way to do it with flake8 directly (the --exclude does not seem to
118- # work with --diff). We could use the exclude magic in the git pathspec
119- # ':!sklearn/externals' but it is only available on git 1.9 and Travis
120- # uses git 1.8.
121- # We need the following command to exit with 0 hence the echo in case
122- # there is no match
123- MODIFIED_FILES=" $( git diff --name-only $COMMIT_RANGE | grep -v ' doc' \
124- || echo " no_match" ) "
125- check_files () {
126- files=" $1 "
127- options=" $2 "
128- # Conservative approach: diff without context (--unified=0) so that code
129- # that was not changed does not create failures
130- git diff --unified=0 $COMMIT_RANGE -- $files | flake8 --diff --show-source $options
131- }
132-
133- if [[ " $MODIFIED_FILES " == " no_match" ]]; then
134- echo " No file outside doc has been modified"
135- else
136- check_files " $( echo " $MODIFIED_FILES " | grep -v ^examples) "
137- # Examples are allowed to not have imports at top of file
138- check_files " $( echo " $MODIFIED_FILES " | grep ^examples) " --ignore=E402
139- fi
116+ # Check the imblearn folder
117+ git diff --unified=0 $COMMIT_RANGE -- ' imblearn' | flake8 --diff --show-source
118+ # Check the example folder
119+ git diff --unified=0 $COMMIT_RANGE -- ' examples' | flake8 --diff --show-source --ignore=E402
140120
141121echo -e " No problem detected by flake8\n"
You can’t perform that action at this time.
0 commit comments