# Git Hooks Setup

## Pre-commit Hook

A pre-commit hook is installed that automatically runs `make check` before each commit to ensure:
- Code passes linting (ruff)
- Code is properly formatted (black)
- Complexity checks pass (radon)
- All tests pass (pytest)

### Installation

The hook is located at `.git/hooks/pre-commit` and should be installed by running:

```bash
# Create the hook
cat > .git/hooks/pre-commit << 'HOOK'
#!/bin/bash
# Pre-commit hook that runs make check before allowing commit

echo "Running make check before commit..."

# Run make check
if ! make check; then
    echo ""
    echo "❌ make check failed!"
    echo "Please fix the issues above before committing."
    echo ""
    echo "To bypass this hook (not recommended), use: git commit --no-verify"
    exit 1
fi

echo "✅ make check passed!"
exit 0
HOOK

# Make it executable
chmod +x .git/hooks/pre-commit
```

### Bypassing the Hook

If you need to bypass the hook (not recommended), use:

```bash
git commit --no-verify
```

### Note

Since `.git/hooks/` is not tracked by git, each developer needs to install this hook manually after cloning the repository.
