Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
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
)
RUN_CLANG_TIDY=""
for candidate in ${RUN_CLANG_TIDY_CANDIDATES[@]}; do
if ! command -v "${candidate}"; then
continue;
fi
RUN_CLANG_TIDY="${candidate}"
break;
done
if [[ -z "${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}"