Skip to content

Instantly share code, notes, and snippets.

@ahmedeltaher
Last active November 26, 2021 16:38
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 ahmedeltaher/da396787859590cf18c487e0e8483773 to your computer and use it in GitHub Desktop.
Save ahmedeltaher/da396787859590cf18c487e0e8483773 to your computer and use it in GitHub Desktop.
Android Git Hooks
echo "Running detekt check..."
OUTPUT="/tmp/detekt-$(date +%s)"
./gradlew detekt > $OUTPUT
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
cat $OUTPUT
rm $OUTPUT
echo "***********************************************"
echo " Detekt failed "
echo " Please fix the above issues before committing "
echo "***********************************************"
exit $EXIT_CODE
fi
rm $OUTPUT
# #!/bin/sh
echo "Running Ktlint linter..."
# Inspect code using Ktlint
./gradlew ktlint --daemon
status=$?
if [ "$status" = 0 ] ; then
echo "Klint linter found no problems."
exit 0
else
echo 1>&2 "Klint linter found violations, Please check it before commit"
exit 1
fi
# #!/bin/sh
echo "Running detekt check..."
# Inspect code using Detekt
./gradlew detekt --daemon
status=$?
if [ "$status" = 0 ] ; then
echo "Static analysis found no problems."
exit 0
else
echo 1>&2 "Please fix the above issues before committing"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment