βambi

contribute

code style

Formatted by one file, commented for the reader, and nothing kept that nothing uses.

formatting

.clang-format formats every file of bambi’s own; tools/format.sh applies it and tools/format.sh --check fails on anything unformatted. The style is Google’s, with 4-space indents and 120 columns.

Two exceptions:

Every file starts with its licence line, // SPDX-License-Identifier: GPL-3.0-or-later.

comments

A comment says what the code does and what a reader cannot see from the code: the unit of a number, an invariant, which thread a function runs on, a reason that is true now.

The same goes for everything a user or a developer reads from the program: check output and test names carry no numbers or references either.

naming

Degrees exist at the interface and in the parameters; radians everywhere inside. A name says which, where it could be either. Milliseconds exist only at the interface; stored times are in seconds.

what stays

the look in code

Every colour, type size, stroke, radius and spacing is a named role in ui/include/bambi/ui/Theme.h. tools/check-style.sh fails on a literal colour, type size or corner radius anywhere else in ui/, editor/ or plugins/. Name the value in the theme and use the name. See the look.