| name | code-quality |
| description | Use when formatting, linting, type checking, or reviewing code quality in the GAC project. Covers ruff, mypy, Makefile targets, and coding standards. |
| tags | ["linting","formatting","type-checking","code-standards"] |
Code Quality Tools and Standards
When to Use
- Formatting code before committing
- Linting code for errors and style issues
- Type checking for correctness
- Reviewing or refactoring code
Makefile Targets (canonical)
make lint and make format run four tools, not just ruff:
make format
make lint
make type-check
make test
Running uv run ruff check . alone does NOT equal make lint. CI runs all four.
Individual Tools
uv run ruff check src/
uv run ruff format src/
uv run mypy src/
Coding Standards
Type Annotations (required)
def parse_response(response: dict[str, Any]) -> str | None:
"""Parse API response and extract content."""
message = response.get("message", {})
return message.get("content")
Naming
- Modules/functions:
snake_case
- Classes:
CapWords
- Constants:
UPPER_SNAKE_CASE
Line Length: 120 characters max
Docstrings: Google-style
def generate(model: str, messages: list[dict]) -> tuple[str, int, int, int, int]:
"""Generate text using the AI provider.
Args:
model: Model name to use.
messages: List of message dictionaries.
Returns:
Tuple of (content, input_tokens, output_tokens, input_cost, output_cost).
"""
File Size: 600 lines max
Split when exceeded — but don't split purely for line count if it hurts cohesion.
Pre-commit Workflow
make format
make lint
make type-check
make test
gac -sy
Note: -s is --scope (infers commit scope), -y is --yes (skips confirmation). Not "short mode".
Checklist
[ ] make format run?
[ ] make lint passes? (all 4 tools)
[ ] make type-check passes?
[ ] make test passes?
[ ] File length under 600 lines?
[ ] Type annotations on all functions?
[ ] Docstrings on public functions?