Code Style
Canon uses automated tools for consistent code style. All checks run in CI.
Python
Linter: Ruff
Ruff handles both linting and formatting:
bash
# Check for lint errors
make lint-backend
# Auto-fix lint errors + format
make formatOr directly:
bash
uv run ruff check # lint
uv run ruff check --fix # auto-fix
uv run ruff format # format
uv run ruff format --check # check formatting without changing filesType Checking: mypy
bash
make typecheck
# or
uv run mypy src/canonConventions
- Python 3.12+ — Use modern syntax (type unions
X | Y,matchstatements, etc.) - Pydantic v2 — All data models use Pydantic with strict validation
- Async by default — Use
async deffor handler functions and API calls - httpx — Async HTTP client (not requests)
Frontend
Linter: ESLint
bash
make lint-frontend
# or
cd frontend && npm run lintType Checking: vue-tsc
bash
cd frontend && npm run type-checkCommit Messages
Use conventional commit format:
type: short description
Longer description if needed.Types:
feat:— New featurefix:— Bug fixdocs:— Documentation changesrefactor:— Code restructuringtest:— Test additions/changeschore:— Build/tooling changesspec:— Spec file additions/changes
Examples:
feat: add Linear ticket sync adapter
fix: handle empty spec sections in parser
docs: update self-hosting guide for Auth0
spec: add user notifications spec