From 05fca2863a198db5d58fd55db6c5d7b67fd46e58 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Tue, 27 Apr 2021 22:19:39 +0530 Subject: Initial setup --- hooks/pre-commit | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 hooks/pre-commit (limited to 'hooks/pre-commit') 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 -- cgit v1.2.1