This directory contains scripts to help maintain code quality and documentation sync.
Runs all quality checks that CI will run. Use this before committing/pushing.
./scripts/check-all.shChecks:
- Code formatting (
cargo fmt --check) - Clippy lints (
cargo clippy --all) - Build (
cargo build) - Unit tests (
cargo test) - Doc tests (
cargo test --doc) - README sync (
./scripts/check-readme-sync.sh) - Benchmarks compile (
cargo bench --no-run)
Exit codes:
0- All checks passed1- One or more checks failed
Verifies that README.md and src/lib.rs documentation are in sync.
./scripts/check-readme-sync.shChecks:
- Doc tests compile and pass
- Section headers match between files
- No common sync issues (code block counts, TODOs, etc.)
- Table of Contents exists
Note: Some differences are expected (e.g., README has Table of Contents, lib.rs doesn't).
Installs Git pre-commit hooks.
./scripts/install-hooks.shInstalls:
- Pre-commit hook that runs doc tests when documentation files are modified
- Reminds you to sync README.md and src/lib.rs
To uninstall:
rm .git/hooks/pre-commitTo bypass hooks (not recommended):
git commit --no-verifyGit pre-commit hook (installed by install-hooks.sh).
Triggers when:
README.mdorsrc/lib.rsare being committed
Actions:
- Runs doc tests
- Reminds about syncing documentation files
Run all checks:
./scripts/check-all.shOr just check documentation sync:
./scripts/check-readme-sync.shInstall pre-commit hooks:
./scripts/install-hooks.sh- Edit
src/lib.rsdoc comments - Mirror changes to
README.md - Run checks:
cargo test --doc ./scripts/check-readme-sync.sh
These scripts are integrated into the GitHub Actions workflow (.github/workflows/rust.yml):
check-readme-sync.sh- Runs on every PR- All checks from
check-all.sh- Run on every push to main and every PR
If you need to modify these scripts:
- Test thoroughly
- Update this README if behavior changes
- Update CONTRIBUTING.md if workflow changes
- Ensure CI workflow still works
See CONTRIBUTING.md for more details on the development workflow.