Skip to content

Instantly share code, notes, and snippets.

@ashishuniyal90
Created July 5, 2021 07:44
Show Gist options
  • Save ashishuniyal90/8ecd2ed0a279f5cde20481062e663469 to your computer and use it in GitHub Desktop.
Save ashishuniyal90/8ecd2ed0a279f5cde20481062e663469 to your computer and use it in GitHub Desktop.
Ktlint Pre-Commit hook
#!/bin/bash
echo "*********************************************************"
echo "Running git pre-commit hook. Running Static analysis... "
echo "*********************************************************"
./gradlew ktlintCheck
status=$?
if [ "$status" = 0 ] ; then
echo "Static analysis found no problems."
exit 0
else
echo "*********************************************************"
echo " ******************************************** "
echo 1>&2 "Static analysis found violations it could not fix."
echo "Run ./gradlew ktlintFormat to fix formatting related issues..."
echo " ******************************************** "
echo "*********************************************************"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment