Repository navigation
C++23 Code Quality Standards
Joe Curlee (w4ffl35) edited this page Feb 17, 2026
·
1 revision
This page defines Curlee's repository-wide code quality standards for C++23.
These standards are intended to be:
- deterministic (machine-checkable where possible),
- practical (focused on maintainability and correctness),
- aligned with Curlee's verification-first philosophy.
Applies to user-maintained code in:
src/**include/**tests/**
Generated files, third-party code, and build outputs are out of scope.
-
Correctness over cleverness
- Favor simple, explicit code over compact or surprising code.
-
Determinism first
- No non-deterministic behavior in core compiler/runtime paths.
-
Small, composable units
- Prefer smaller functions and focused modules.
-
No silent degradation
- Unsupported behavior should produce explicit diagnostics/errors.
-
DRY and local clarity
- Avoid copy/paste logic; extract reusable helpers when duplication appears.
These are quality thresholds, not absolute language limits.
- Max line length: 100 characters (soft), 120 (hard)
- Max file length: 600 non-empty, non-comment lines
- Max function length: 80 non-empty lines
- Max approximate cyclomatic complexity: 15 per function
- Max duplicated normalized lines per file-pair: 40 (heuristic)
Threshold breaches should create refactor tasks unless there is a documented, justified exception.
- Public interfaces in
include/should have concise API comments. - Comments should explain why, not restate what obvious code already says.
-
TODO/FIXMEcomments require either:- a linked issue number, or
- immediate cleanup before merge.
Bad:
// increment i
Good:
// Keep deterministic ordering for stable golden diagnostics.
- Prefer value semantics and explicit ownership.
- Prefer
std::expected/result-style error returns for domain failures. - Prefer ranges algorithms when they improve readability.
- Avoid unnecessary dynamic allocation and hidden global state.
- Keep includes minimal and stable (
<...>vs"..."hygiene).
See also: repository guide C++23 Best Practices for LLM Agents.md.
- Use clear domain names (avoid single-letter variables except tiny loop indices).
- Keep branch nesting shallow; prefer early returns.
- Preserve stable diagnostic messages unless a behavior change requires updates.
- Keep tests close to behavior; add targeted tests for every behavior branch touched.
- Run quality audit script:
python3 scripts/quality_audit.py --format json --out build/quality/quality_report.json
- Review deterministic report.
- Bulk-file issues per violating file:
python3 scripts/quality_bulk_issues.py --report build/quality/quality_report.json --apply
- Use label convention
area:qualityand title prefix[quality-refactor]. - Do not resume feature work until refactor queue is completed.
Exceptions are allowed only when:
- justified in issue discussion, and
- accompanied by tests and rationale.
If a file must exceed a threshold temporarily, the corresponding issue must track removal of the exception.