Newer
Older
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
ROOTDIR="$(realpath "${SCRIPTDIR}/..")"
while getopts dv OPT; do
case $OPT in
d)
set -x
;;
*)
echo "usage: ${0##*/} [-d]"
exit 2
esac
done
shift $(( OPTIND - 1 ))
OPTIND=1
RUN_CLANG_TIDY_CANDIDATES=(
run-clang-tidy
run-clang-tidy.py
/usr/share/clang/run-clang-tidy.py
)
for candidate in "${RUN_CLANG_TIDY_CANDIDATES[@]}"; do
if ! command -v "${candidate}"; then
continue;
fi
RUN_CLANG_TIDY="${candidate}"
break;
done
if [[ ! -v RUN_CLANG_TIDY ]]; then
echo "No run-clang-tidy executable found"
exit 1
fi
JOBS=$(nproc)
${RUN_CLANG_TIDY} \
-p "${ROOTDIR}/compile_commands_wo_subprojects/" \
-j "${JOBS}"