I have a CI script that runs clang tidy on all the cpp files to ensure that all the files are written using the rules set up in the config file. Currently, I have a script that finds all the necessary files (cpp and shader files) and runs clang tidy on them:
# scripts/clang-tidy-all.sh
#!/bin/sh
if [ -z $1 ]; then
CMD=clang-tidy
else
CMD=clang-tidy-$1
fi
find engine/src editor/src -type f -name "*.cpp" -o -name "*.frag" -o -name "*.vert" | xargs -I{} $CMD -header-filter=.* --p=file --quiet {} -- --std=c++17 -isystem./vendor/include -isystem./engine/src -isystem./editor/src/ -isystem./platform-tools/include -isystem/usr/local/include
## Usage from CLI
./scripts/clang-tidy-all.sh 14
This script takes 26 minutes on my CI system (I am using Github actions with their workers), which is longer than building the entire project. Is there some way to make this clang-tidy run faster. I am planning on running these tests in threads through some kind of a job system as well but I want something to make the static analysis itself faster.