10000 TRAVIS fix flake8_diff.sh check_files (#8208) · scikit-learn/scikit-learn@0eb33ad · GitHub
[go: up one dir, main page]

Skip to content

Commit 0eb33ad

Browse files
authored
TRAVIS fix flake8_diff.sh check_files (#8208)
when $files is empty. A sphinx-gallery updated introduced flake8 violations which were not ignored because $files was empty so all the files were checked instead of only the examples.
1 parent eabaef3 commit 0eb33ad

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

build_tools/travis/flake8_diff.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,13 @@ MODIFIED_FILES="$(git diff --name-only $COMMIT_RANGE | grep -v 'sklearn/external
125125

126126
check_files() {
127127
files="$1"
128-
options="$2"
129-
# Conservative approach: diff without context (--unified=0) so that code
130-
# that was not changed does not create failures
131-
git diff --unified=0 $COMMIT_RANGE -- $files | flake8 --diff --show-source $options
128+
shift
129+
options="$*"
130+
if [ -n "$files" ]; then
131+
# Conservative approach: diff without context (--unified=0) so that code
132+
# that was not changed does not create failures
133+
git diff --unified=0 $COMMIT_RANGE -- $files | flake8 --diff --show-source $options
134+
fi
132135
}
133136

134137
if [[ "$MODIFIED_FILES" == "no_match" ]]; then

0 commit comments

Comments
 (0)
0