blob: cd61a5c48e010bbbf3af1b6e10f35a991f9cf270 (
plain)
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
|
#!/usr/bin/env bash
set -e
set -o pipefail
export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
CLANG_TIDY=${CLANG_TIDY:-$(mason prefix clang-tidy 3.8)/bin/clang-tidy}
command -v ${CLANG_TIDY} >/dev/null 2>&1 || {
echo "Can't find ${CLANG_TIDY} in PATH."
if [ -z ${CLANG_TIDY} ]; then
echo "Alternatively, you can set CLANG_TIDY to point to clang-tidy."
fi
exit 1
}
cd $1
function check_tidy() {
OUTPUT=$(${CLANG_TIDY} $0 -p=. -header-filter='mbgl' 2>/dev/null)
if [[ -n $OUTPUT ]]; then
echo "Error: A clang-tidy warning/error happened:"
echo -e "$OUTPUT"
exit 1
fi
}
export CLANG_TIDY
export -f check_tidy
echo "Running clang-tidy checks... (this might take a while)"
git ls-files '../../../src/mbgl/*.cpp' '../../../platform/*.cpp' '../../../test/*.cpp' | \
xargs -I{} -P ${JOBS} bash -c 'check_tidy' {}
|