amethyst/git-hooks/pre-commit

29 lines
786 B
Plaintext
Raw Permalink Normal View History

2023-03-07 19:08:11 +01:00
#!/bin/bash
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
echo "*********************************************************"
echo "Running git pre-commit hook. Running Static analysis... "
echo "*********************************************************"
2023-10-17 15:36:26 -04:00
echo ""
echo "Java Version: "
echo "$JAVA_HOME"
echo "$(java -version)"
echo "Running test... "
2023-03-07 19:08:11 +01:00
2024-01-06 10:44:05 -05:00
./gradlew spotlessCheck
2023-03-07 19:08:11 +01:00
status=$?
if [ "$status" = 0 ] ; then
echo "Static analysis found no problems."
exit 0
else
echo "*********************************************************"
echo 1>&2 "Static analysis found violations it could not fix."
2024-01-06 10:44:05 -05:00
printf "Run ${GREEN}./gradlew spotlessApply${NO_COLOR} to fix formatting related issues...\n"
2023-03-07 19:08:11 +01:00
echo "*********************************************************"
exit 1
fi