diff options
Diffstat (limited to 'hooks')
-rw-r--r-- | hooks/pre-commit | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100644 index 0000000..00d361b --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,14 @@ +#!/bin/sh + +./gradlew spotlessCheck -q +EXIT_CODE=$? +if [ $EXIT_CODE -ne 0 ]; then + echo "❌ spotlessCheck failed, running spotlessApply for you..." + + ./gradlew spotlessApply -q + + echo "Formatting done, please try your commit again! If the problem persists, apply fixes manually." + exit $EXIT_CODE +fi + +exit 0
\ No newline at end of file |