This project uses pre-commit hooks to maintain code quality.
# 1. Initialize git (if not already done)
git init
# 2. Sync dependencies
uv sync
# 3. Install pre-commit hooks
uv run pre-commit install
# 4. (Optional) Run on all files to test
uv run pre-commit run --all-files- Formatting: Code style, line length, quotes
- Linting: Errors, warnings, code smells
- Import sorting: Organizes imports
- Auto-fixes: Many issues fixed automatically
- Bandit: Checks for common security issues
- mypy: Static type checking
- Trailing whitespace removal
- End-of-file fixes
- YAML/TOML/JSON syntax validation
- No large files committed
- No merge conflicts
- markdownlint: Markdown formatting
- yamllint: YAML linting
Hooks run automatically on git commit:
git add .
git commit -m "Your message"
# Hooks run here - will block commit if checks failRun hooks manually:
# Run all hooks on all files
uv run pre-commit run --all-files
# Run specific hook
uv run pre-commit run ruff --all-files
uv run pre-commit run ruff-format --all-files
# Run on staged files only
uv run pre-commit run# Update to latest versions
uv run pre-commit autoupdate
# Clean and reinstall
uv run pre-commit clean
uv run pre-commit install --install-hooks# Skip all hooks (not recommended)
git commit --no-verify -m "Message"
# Skip specific hook
SKIP=bandit git commit -m "Message"- Read the error output carefully
- Most issues are auto-fixable:
uv run pre-commit run --all-files - Fix remaining issues manually
- First run downloads hook environments (one-time)
- Subsequent runs are much faster
uv run pre-commit clean
uv run pre-commit install --install-hooks.pre-commit-config.yaml: Main pre-commit configurationpyproject.toml: Ruff, bandit, pytest, mypy settings.yamllint.yaml: YAML linting rules.markdownlint.yaml: Markdown linting rules