localspot/scripts/pre-commit

26 lines
465 B
Text
Raw Permalink Normal View History

#!/bin/sh
#
# Pre-commit hook for localspot
# Runs formatting and tests before allowing commits
#
# To install: cp scripts/pre-commit .git/hooks/pre-commit
set -e
echo "Running pre-commit checks..."
# Format code and stage any changes
echo "Formatting code..."
mix format
git add -u
# Run tests
echo "Running tests..."
mix test
if [ $? -ne 0 ]; then
echo "❌ Tests failed. Please fix before committing."
exit 1
fi
echo "✅ All pre-commit checks passed!"