diff options
Diffstat (limited to 'buildtools/clangtidy-helper.sh')
-rw-r--r-- | buildtools/clangtidy-helper.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/buildtools/clangtidy-helper.sh b/buildtools/clangtidy-helper.sh new file mode 100644 index 0000000..f4ef5b9 --- /dev/null +++ b/buildtools/clangtidy-helper.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +## +## usage: clangtidy-helper [list of cpp files] +## +## Without arguments, run for all source files. +## + +set -e + +mkdir -p build +cd build + +cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + +run-clang-tidy -fix -header-filter='.*' "$@" > /dev/null || true + +# revert all fixes in protected directories +git checkout ../src/3rdparty/ ../src/2geom/ + +git diff | tee clang_tidy_diff + +if [[ -s clang_tidy_diff ]]; then + exit 1 +fi |