Skip to content

Instantly share code, notes, and snippets.

@brianPlummer
Created July 30, 2019 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianPlummer/d80ab9552d79340fbcd63594982fead4 to your computer and use it in GitHub Desktop.
Save brianPlummer/d80ab9552d79340fbcd63594982fead4 to your computer and use it in GitHub Desktop.
Pre-push ktlint check
#!/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