42 lines
1.9 KiB
YAML
42 lines
1.9 KiB
YAML
# Style contract for this repo. Taken from the CPP modules, so both codebases
|
|
# read the same way, with the Standard line corrected — see below.
|
|
# Google as the base (2-space indent, K&R braces, west-const pointers).
|
|
---
|
|
Language: Cpp
|
|
BasedOnStyle: Google
|
|
|
|
# `Standard` only tells clang-format how to *parse* the source; it has nothing to
|
|
# do with what the compiler is given. There is no `c++23` value — the enum stops
|
|
# at `c++20` plus `Latest` and `Auto` (verified against clang-format 18.1.3:
|
|
# c++23 rejected, c++20/Latest/Auto accepted), and an unknown value makes
|
|
# clang-format refuse the whole file with "unknown enumerated scalar", not fall
|
|
# back to a default. `Latest` is the value that means "the newest this binary
|
|
# knows". The language standard is set once, in the Makefile: `-std=c++23`.
|
|
Standard: Latest
|
|
|
|
# 80 columns, straight from the Google C++ Style Guide ("Line Length"). This is
|
|
# the dominant limit across C++ house styles: Google, LLVM, Chromium, Mozilla,
|
|
# Abseil, folly. The 100 used by Rust/Kotlin/Qt is a newer-language convention
|
|
# and does not carry over. Nothing to do with norminette, which is a C rule.
|
|
ColumnLimit: 80
|
|
|
|
IndentWidth: 2
|
|
# Access specifiers get their own indent level: `public:` at 2, members at 4.
|
|
IndentAccessModifiers: true
|
|
|
|
# `T& name` / `T* name` — west style.
|
|
PointerAlignment: Left
|
|
ReferenceAlignment: Pointer
|
|
|
|
# One-liner bodies allowed only for functions defined inside a class — trivial
|
|
# accessors in headers. An out-of-line definition always gets a real body.
|
|
# (The CPP modules use None; Google and LLVM both default to All. Inline is the
|
|
# middle ground, and the only part of this file that deviates from them.)
|
|
AllowShortFunctionsOnASingleLine: Inline
|
|
AllowShortIfStatementsOnASingleLine: Never
|
|
AllowShortLoopsOnASingleLine: false
|
|
AllowShortCaseLabelsOnASingleLine: false
|
|
|
|
# Include order is deliberate (own header first, then std by topic) — don't shuffle.
|
|
SortIncludes: false
|