Set up clang-tidy static analysis

Table of Contents

This page is a capture in the inbox bucket of the product backlog — a pre-sprint idea, not yet pulled into a sprint as a story.

What

Add clang-tidy to the build infrastructure as a complement to clang-format. Unlike clang-format (which only cares about layout), clang-tidy performs semantic static analysis: detecting bugs, flagging anti-patterns, and suggesting modern C++ idioms. The story would produce: a .clang-tidy config with a curated check set, CMake tidy and check-tidy targets backed by run-clang-tidy.py (from the LLVM toolchain), and a nightly GH Actions workflow that raises a PR when new violations appear.

Why

clang-format keeps the code consistently laid out; clang-tidy keeps it consistently correct and modern. Together they form a lightweight quality baseline that catches issues before code review. The infrastructure (compile_commands.json from CMake, FindClangTools.cmake now updated) is already in place.

The check set needs careful curation — enabling everything produces thousands of false positives. A minimal starting set might be: modernize-*, readability-*, bugprone-*, clang-analyzer-*, with per-file suppressions for generated code.

References

See also

Emacs 29.1 (Org mode 9.6.6)