Development setup¶
Checks before each commit¶
The repository uses pre-commit to check every commit,
for example for large files that belong in Git LFS or for leftover merge-conflict
markers. The checks are listed in .pre-commit-config.yaml in the repository
root.
Install pre-commit once, for example with uv, and enable it in each clone:
uv tool install pre-commit
pre-commit install
The Git hook calls the installed pre-commit, so use uv tool install rather
than uvx: a hook set up through uvx points into uv’s cache and stops working
when the cache is cleaned.
From then on the checks run on the staged files whenever you commit. If a check fails or changes a file, the commit is stopped; review the result, stage it and commit again. To run all checks on the whole repository:
pre-commit run --all-files
Formatting¶
C++ sources (.cpp, .hpp) are formatted with clang-format according to
.clang-format in the repository root: four spaces, braces on the same line,
at most 120 characters per line. The pre-commit check runs clang-format 23.1.2
on the staged files and stops the commit if it had to change anything; stage
the reformatted files and commit again. To format files by hand with the same
version:
uvx --from clang-format==23.1.2 clang-format -i path/to/file.cpp
Commits that only reformat code are listed in .git-blame-ignore-revs. To
have git blame skip them, run once per clone:
git config blame.ignoreRevsFile .git-blame-ignore-revs
Copyright and license information¶
The repository follows the REUSE specification: every file states its copyright holder and license. Source files carry an SPDX header at the top:
// SPDX-FileCopyrightText: Dirk Fortmeier
//
// SPDX-License-Identifier: MIT
Documentation, configuration, lock files, the website and data are covered by
REUSE.toml in the repository root instead. The license texts are in
LICENSES/. The pre-commit check rejects committed files without this
information. To add the header to new source files, run:
scripts/dev/reuse_annotate.sh
To check the whole repository:
uvx --from 'reuse[charset-normalizer]' reuse lint