'A smarter clang-tidy run: only check changed files & other source files that include a changed header?

We use the run-clang-tidy script to check the whole component after a build like so:

run-clang-tidy-12 -p build -header-filter="(src|libraries)" src libraries

We would like to run this (by changing the parameters) only on the files that are changed and for all source files that include a changed header file. As we're using git, maybe together with gcc it can give use that list of files.

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source