- Add scripts/pre-commit hook that runs format check and tests - Add mix hooks.install alias to install the hook - Document git hooks in AGENTS.md - Fix test database config to use local user 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
591 B
Bash
Executable file
28 lines
591 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Pre-commit hook for localspot
|
|
# Runs formatting check and tests before allowing commits
|
|
#
|
|
# To install: cp scripts/pre-commit .git/hooks/pre-commit
|
|
|
|
set -e
|
|
|
|
echo "Running pre-commit checks..."
|
|
|
|
# Check formatting (without modifying files)
|
|
echo "Checking code formatting..."
|
|
mix format --check-formatted
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Code is not formatted. Run 'mix format' to fix."
|
|
exit 1
|
|
fi
|
|
|
|
# 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!"
|