Skip to content

Commit

Permalink
Merge 1b70d0c into b7a4cb6
Browse files Browse the repository at this point in the history
  • Loading branch information
bashtage committed Sep 27, 2018
2 parents b7a4cb6 + 1b70d0c commit 64e73df
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ if [ "$LINT" == true ]; then
fi

# Tests any new python files
git fetch --unshallow --quiet
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin --quiet
if [ -f $(git rev-parse --git-dir)/shallow ]; then
# Unshallow only when required, e.g., on CI
echo Repository is shallow
git fetch --unshallow --quiet
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin --quiet
fi
NEW_FILES=$(git diff origin/master --name-status -u -- "*.py" | grep ^A | cut -c 3- | paste -sd " " -)
if [ -n "$NEW_FILES" ]; then
echo "Linting newly added files with strict rules"
echo "New files: " $NEW_FILES
flake8 --isolated $(eval echo $NEW_FILES)
if [ $? -ne "0" ]; then
echo "New files failed linting."
Expand Down
6 changes: 6 additions & 0 deletions one.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is a valid file
x = 1.0


class NewClass(object):
pass
6 changes: 6 additions & 0 deletions two.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is an invalid file

x = 1.0 + 3



0 comments on commit 64e73df

Please sign in to comment.