#!/bin/bash # Navigate to the root of the repository cd "$(git rev-parse --show-toplevel)" # Run spotlessCheck ./gradlew spotlessCheck # Capture the exit code EXIT_CODE=$? if [ $EXIT_CODE -ne 0 ]; then echo "======================================================================================" echo "Spotless found some formatting issues. Please run ./gradlew spotlessApply to fix them." echo "======================================================================================" exit 1 else echo "===================================" echo "Spotless check passed successfully!" echo "===================================" fi