Skip to content

Commit 305025b

Browse files
author
Guillaume Lemaitre
committed
Avoid to check the doc
1 parent ee949b9 commit 305025b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

build_tools/travis/flake8_diff.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ echo '--------------------------------------------------------------------------
120120
# uses git 1.8.
121121
# We need the following command to exit with 0 hence the echo in case
122122
# there is no match
123-
MODIFIED_FILES="$(git diff --name-only $COMMIT_RANGE || echo "no_match")"
123+
MODIFIED_FILES="$(git diff --name-only $COMMIT_RANGE | grep -v 'doc'
124+
|| echo "no_match")"
124125

125126
check_files() {
126127
files="$1"
@@ -130,8 +131,12 @@ check_files() {
130131
git diff --unified=0 $COMMIT_RANGE -- $files | flake8 --diff --show-source $options
131132
}
132133

133-
check_files "$(echo "$MODIFIED_FILES" | grep -v ^examples)"
134-
# Examples are allowed to not have imports at top of file
135-
check_files "$(echo "$MODIFIED_FILES" | grep ^examples)" --ignore=E402
134+
if [[ "$MODIFIED_FILES" == "no_match" ]]; then
135+
echo "No file outside doc has been modified"
136+
else
137+
check_files "$(echo "$MODIFIED_FILES" | grep -v ^examples)"
138+
# Examples are allowed to not have imports at top of file
139+
check_files "$(echo "$MODIFIED_FILES" | grep ^examples)" --ignore=E402
140+
fi
136141

137142
echo -e "No problem detected by flake8\n"

0 commit comments

Comments
 (0)