From d4f6cac686bdd92b913a8877c5a984dc0082b7a8 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Mon, 15 May 2017 15:06:15 +0300 Subject: [tidy] run-clang-tidy.py reads source files from compile_commands.json --- scripts/clang-tools.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/clang-tools.sh b/scripts/clang-tools.sh index 48675e3ab1..0debe931a7 100755 --- a/scripts/clang-tools.sh +++ b/scripts/clang-tools.sh @@ -19,17 +19,13 @@ for CLANG_FILE in "${CLANG_TIDY} ${CLANG_APPLY} ${CLANG_FORMAT}"; do } done -cd $1 - -export CDUP=$(git rev-parse --show-cdup) export CLANG_TIDY CLANG_APPLY CLANG_FORMAT function run_clang_tidy() { - FILES=$(git ls-files "src/mbgl/*.cpp" "platform/*.cpp" "test/*.cpp") ${CLANG_TIDY_PREFIX}/share/run-clang-tidy.py -j ${JOBS} \ -clang-tidy-binary ${CLANG_TIDY} \ -clang-apply-replacements-binary ${CLANG_APPLY} \ - -fix ${FILES} 2>/dev/null || exit 1 + -p $1 -fix 2>/dev/null || exit 1 } function run_clang_tidy_diff() { @@ -55,6 +51,8 @@ export -f run_clang_tidy run_clang_tidy_diff run_clang_format echo "Running Clang checks... (this might take a while)" if [[ -n $2 ]] && [[ $2 == "--diff" ]]; then + cd $1 + export CDUP=$(git rev-parse --show-cdup) run_clang_tidy_diff $@ # XXX disabled until we run clang-format over the entire codebase. #run_clang_format $@ -- cgit v1.2.1