Last active
November 26, 2021 16:38
-
-
Save ahmedeltaher/da396787859590cf18c487e0e8483773 to your computer and use it in GitHub Desktop.
Android Git Hooks
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
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 |
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 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 |
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 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