Skip to main content
Consistency across the codebase makes reviews faster and diffs cleaner. All C++ code is enforced by clang-format and checked by clang-tidy. Lua and SQL conventions are followed by convention.

C++ Style

The project targets C++20 and uses a style based on WebKit with Allman braces. The canonical configuration lives in .clang-format at the repository root and is compatible with clang-format-20.

Key rules

RuleValue
Brace styleAllman (braces on their own line)
Indent width4 spaces
TabsNever — spaces only
Column limit0 (use your best judgement)
Pointer alignmentLeft (int* ptr)
StandardLatest (C++20)
Short blocks/ifs/loops on one lineNever
Template declarationsAlways break before <
Include sortingEnabled
Consecutive alignmentAssignments, declarations, and macros are aligned

Allman brace example

if (condition)
{
    doSomething();
}
else
{
    doSomethingElse();
}

Access modifiers

Access modifiers (public:, private:, protected:) use an offset of -4 so they sit flush with the class body rather than indented.
class MyClass
{
public:
    void publicMethod();

private:
    int m_value;
};

Running clang-format

# From the repository root
python tools/run_clang_format.py

clang-tidy checks

The .clang-tidy configuration enables a focused set of checks:
Checks: >-
  -*,
  cppcoreguidelines-avoid-goto,
  cppcoreguidelines-init-variables,
  cppcoreguidelines-no-malloc,
  cppcoreguidelines-pro-type-const-cast,
  cppcoreguidelines-pro-type-member-init,
  cppcoreguidelines-slicing,
  cppcoreguidelines-special-member-functions,
  cppcoreguidelines-virtual-class-destructor,
  misc-definitions-in-headers,
  modernize-pass-by-value,
  modernize-use-emplace,
  modernize-use-nullptr,
  modernize-use-override,
  performance-*
clang-tidy is run in CI automatically. You can run it locally via the dev Docker Compose setup (see Development workflow).

Build docs developers (and LLMs) love