#!/bin/sh

echo "Running static analysis..."

# Validate Kotlin code with detekt and KtLint before committing
./gradlew check --daemon

status=$?

if [ "$status" = 0 ] ; then
    echo "Static analysis found no issues. Proceeding with push."
    exit 0
else
    echo 1>&2 "Static analysis found issues you need to fix before pushing."
    exit 1
fi

#!/bin/sh

echo "Running static analysis..."

# Validate Kotlin code with detekt and KtLint before committing
./gradlew check --daemon

status=$?

if [[ "$status" = 0 ]] ; then
    echo "Static analysis found no issues. Proceeding with push."
    exit 0
else
    echo 1>&2 "Static analysis found issues you need to fix before pushing."
    exit 1
fi

--- 
+++ 
@@ -7,7 +7,7 @@
 
 status=$?
 
-if [ "$status" = 0 ] ; then
+if [[ "$status" = 0 ]] ; then
     echo "Static analysis found no issues. Proceeding with push."
     exit 0
 else
Use single brackets for if in git hooks
