Created
July 30, 2019 15:39
-
-
Save brianPlummer/d80ab9552d79340fbcd63594982fead4 to your computer and use it in GitHub Desktop.
Pre-push ktlint check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "Running static analysis (ktlintcheck)..." | |
./gradlew ktlintcheck --daemon | |
status=$? | |
if [ "$status" = 0 ] ; then | |
echo "Static analysis found no errors." | |
else | |
echo 1>&2 "Static analysis found violations it could not fix." | |
exit 1 | |
fi | |
echo "Checking git status for changes" | |
if [[ `git status --porcelain` ]]; then | |
# Changes | |
echo "changes found" | |
exit 1 | |
else | |
# No changes | |
echo "no changes" | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment