summaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
authorAmit Kumar <amitkma@e.email>2021-04-27 22:19:39 +0530
committerAmit Kumar <amitkma@e.email>2021-04-27 22:19:39 +0530
commit05fca2863a198db5d58fd55db6c5d7b67fd46e58 (patch)
tree952fa67f0f03adf081ecec55a9c1bc0a920df7d1 /hooks
Initial setup
Diffstat (limited to 'hooks')
-rw-r--r--hooks/pre-commit14
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