ZaStoGram_desktop/tools/clangtidy
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-23 13:21:00 +03:00
..
compile_db.py [git-hook] Added hook setup and staged clang-tidy checks. 2026-11-23 13:21:00 +03:00
README.md [git-hook] Added hook setup and staged clang-tidy checks. 2026-11-23 13:21:00 +03:00

clang-tidy for tdesktop

python3 tools/clangtidy/compile_db.py               # after each configure
git diff -U0 HEAD | clang-tidy-diff.py -p1 -path out/clang-tidy -j 10 -quiet
run-clang-tidy -p out/clang-tidy -j 10 -quiet <files>

Both runners ship with LLVM, under share/clang. Needs clang-tidy 20 or newer: an older one ignores CustomFunctions without a word.

Git hooks

python3 tools/rules/install.py
python3 tools/rules/test_hook.py

Build the optional plugin with python3 ../stylecheck/run.py build. The plugin checks wrapped constructor parameters and nested multiline arguments. Nested-call diagnostics offer a whitespace fix when the result fits the 78-column limit. Preview the fixes with:

python3 ../stylecheck/run.py sweep "$PWD" --db out/clang-tidy \
    --check tdesktop-nested-multiline-call --diff

After a Ninja build, rerun python3 tools/clangtidy/compile_db.py to index its header dependencies. The hook uses that index to find a compiled C++ source that includes each staged header. A header absent from the index can still be checked through a staged source that includes it or a compiled source with the same basename. Diagnostics are limited to the staged lines.