Skip to content

Commit 95955f0

Browse files
committed
Remove .commit file when flake8 command fails
Fixes: https://github.com/rapidpro/rapidpro/issues/989
1 parent 40fe59c commit 95955f0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pre-commit.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,11 @@ if [ -n "$FILES" ]; then
1717
fi
1818

1919
if [ -n "$FILES" ]; then
20-
flake8 $FILES
20+
flake8_errors=$(flake8 --exit-zero $FILES)
21+
22+
if [ ! -z "$flake8_errors" ]; then
23+
rm -f .commit
24+
echo "$flake8_errors"
25+
exit 1
26+
fi
2127
fi

0 commit comments

Comments
 (0)