ADR-0008: One naming scheme, enforced by clang-tidy¶
- Status: Accepted
- Date: 2026-11-03
Context¶
The review found methods in PascalCase, camelCase and snake_case; units written _mA, _ma, Ma, Mv, Ua
or as a Unit enum; symbols declared at global scope; driver classes named Device or Driver; and diverging
.clang-format files (column limit 100 in most, 120 in some) and .clang-tidy files with no naming rules.
Decision¶
- Namespaces:
<chip>for drivers,kbfor kb-core,kb::halfor the shared HAL,<board>for board code,<board>::appfor products. Drivers carry no org prefix (ADR-0012). - Types, functions and public methods PascalCase; private methods camelBack; variables and parameters snake_case;
private members
snake_case_; constantskPascalCase; macrosUPPER_CASE; units as suffixes;Read*for calls that touch the bus. Datasheet names may stayUPPER_CASE. - One include root per repository or kb-core part (
kb/interfaces/BaseSpi.h). - One org
.clang-format(LLVM base, 100 columns) and one.clang-tidywithreadability-identifier-naming, kept inkokeb-labs/.github/standards/config/and copied unchanged into each repository's_config/.
Consequences¶
- Names are predictable across the stack, and a reviewer no longer argues style.
- Private helpers stay camelBack, which register-level drivers already use, so they pass with few findings.
- Code brought in at 120 columns reformats once, in a PR that changes nothing else.
- Public API renames (camelCase methods, unit spellings) are breaking changes and land with the v0.1 API work.