Pass only one file for each clang-tidy invocation. This is necessary to ensure that clang-tidy finds the correct compile_commands.json for each file.
diff --git a/scripts/run_clang_tidy_format.sh b/scripts/run_clang_tidy_format.sh index 664e989..238333a 100755 --- a/scripts/run_clang_tidy_format.sh +++ b/scripts/run_clang_tidy_format.sh
@@ -43,7 +43,7 @@ rm -f tidy-*.fail # sh syntax is -c "string" [name [args ...]], so "tidy" here is the name and not included in "$@" -echo ${HEADERS} ${SOURCES} | xargs -P${PARALLEL_JOBS} -n5 sh -c "${CLANG_TIDY} -export-fixes=\$(mktemp -p. tidy.fail-XXXX) \$@" tidy +echo ${HEADERS} ${SOURCES} | xargs -P${PARALLEL_JOBS} -n1 sh -c "${CLANG_TIDY} -export-fixes=\$(mktemp -p. tidy.fail-XXXX) \$@" tidy if [ $(find . -maxdepth 1 -name 'tidy.fail-*' -size +0 | wc -l) -gt 0 ] ; then # clang-tidy put non-empty output in one of the tidy-*.fail files cat tidy.fail-*