# Pre-Commit Hook
## Automatic Checks
The pre-commit hook runs automatically before each commit and ensures:
✅ **Format** - Code is properly formatted (`cargo fmt`)
✅ **Clippy** - No warnings (`cargo clippy -D warnings`)
✅ **Build** - Project compiles
✅ **Tests** - All tests pass
✅ **Doctests** - Documentation examples work
If any check fails, the commit is blocked.
## Installation
Already installed at `.git/hooks/pre-commit` ✅
## Usage
### Normal Commit
```bash
git commit -m "your message"
# Pre-commit checks run automatically
```
### Skip Hook (Emergency Only)
```bash
git commit --no-verify -m "your message"
```
### Manual Check
```bash
.git/hooks/pre-commit
```
### Quick Check (Faster)
For rapid iteration, use the quick check:
```bash
./scripts/quick-check.sh
```
Skips doctests for speed.
## What It Checks
Matches CI workflows exactly:
- `cargo fmt --check`
- `cargo clippy --all-targets --all-features`
- `cargo build --all-features`
- `cargo test --all-targets --all-features`
- `cargo test --doc`
## Troubleshooting
**Hook not running?**
```bash
chmod +x .git/hooks/pre-commit
```
**Too slow?**
Use `./scripts/quick-check.sh` during development, full check before push.
**Disable temporarily?**
```bash
git commit --no-verify
# or
mv .git/hooks/pre-commit .git/hooks/pre-commit.bak
```