This guide covers development environment setup for ASAP.
Pre-commit hooks ensure code quality before committing.
pip3 install pre-commit
# Install hooks (run from repo root)
cd /path/to/ASAPQuery-backend
pre-commit installThe pre-commit configuration (.pre-commit-config.yaml) runs:
Rust:
rustfmt- Format Rust codecargo check- Check Rust code compilescargo clippy- Lint Rust code (all warnings as errors)
Python:
black- Format Python codeisort- Sort Python importsflake8- Lint Python codemypy- Type check Python code (in components that have it configured)
General:
- Remove trailing whitespace
- Ensure files end with newline
- Validate YAML files
- Check for large files
Automatic (on git commit):
git add myfile.rs
git commit -m "Fix bug"
# Pre-commit hooks run automaticallyManual (run on all files):
pre-commit run --all-filesManual (run on staged files):
pre-commit runIssue: black or rustfmt fails
Solution: The hook auto-fixes formatting. Just re-stage and commit:
git add <file>
git commitIssue: clippy warnings
Solution: Fix warnings
Issue: cargo fmt checks failed
Solution: Run cargo fmt --