* Use a System clang-tidy When Available and Make --fix Converge in One Pass
scripts/run_clang_tidy.sh only looked at CLANG_TIDY and the venv it creates,
so a clang-tidy already on the system was never used. It is now the first
choice: the pinned version outright, another version after a prompt that
says results may differ slightly from CI, which -y and an existing pinned
venv skip.
Two problems in clang_tidy_diff.py made --fix need several runs and still
leave the plain check failing:
- A deleted #include orphans uses on unchanged lines. The plain check runs
such a file whole and reports them, but --fix kept the line filter to the
changed lines, so they were never fixed. Fix mode now runs the file whole
first and then fixes exactly the changed lines plus the lines that run
found wanting, so unrelated lines are still never rewritten.
- clang-tidy exits non-zero for the findings it just fixed, so every fixed
file was reported as failed and the user ran --fix again to see what was
left. A file --fix changed is now checked again and the fixed files are
listed separately from what --fix could not add.
CI runs the script without --fix and is unchanged.
* Keep the a/ b/ Diff Prefixes Whatever the User's Git Config Says
parse_diff recognises a changed file by its +++ b/ header. With
diff.noprefix or diff.mnemonicPrefix set, git prints +++ src/x.cpp or
+++ w/src/x.cpp instead, every file was dropped, and the local check
reported no changed C++ lines. The diff is now asked for the a/ and b/
prefixes outright, which overrides both settings.
* Warn When No Remote Points at OrcaSlicer/OrcaSlicer
Without one, run_clang_tidy.sh compares against origin/main. When origin
is a fork whose main already holds the commits, the check finds nothing
and says so, without hinting at why. The script now names the base it
fell back to and how to point it at the upstream repository.
A Linux job configures without the precompiled header and runs clang-tidy over the C++ lines a pull request changes. The only check for now is misc-include-cleaner for missing includes; .clang-tidy is where further checks get enabled.
scripts/run_clang_tidy.sh (Linux, macOS) and scripts/run_clang_tidy.ps1 (Windows) run the same check locally: the same configure, the clang-tidy version pinned in scripts/clang_tidy_requirements.txt, and the same comparison against OrcaSlicer's main. They offer to install what is missing, or print the command to do it by hand.