1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

LINT: add clang-tidy step (#6295)

* Implement new travis clang-tidy build step

* This step enable some rules and enforce one rule as error
* This permits to have some C++ quality rules based on clang & clang contributor guidelines

* Fix clang-tidy reported problems on push_back -> emplace_back
This commit is contained in:
Loïc Blot 2018-04-01 23:57:55 +02:00 committed by GitHub
parent 93eb0794d6
commit d88c4e1822
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 319 additions and 8 deletions

27
util/travis/clangtidy.sh Executable file
View file

@ -0,0 +1,27 @@
if hash clang-tidy-5.0 2>/dev/null; then
CLANG_TIDY=clang-tidy-5.0
else
CLANG_TIDY=clang-tidy
fi
files_to_analyze="$(find src/ -name '*.cpp' -or -name '*.h')"
mkdir -p cmakebuild && cd cmakebuild
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DRUN_IN_PLACE=TRUE \
-DENABLE_GETTEXT=TRUE \
-DENABLE_SOUND=FALSE \
-DBUILD_SERVER=TRUE ..
make GenerateVersion
cd ..
echo "Performing clang-tidy checks..."
./util/travis/run-clang-tidy.py -clang-tidy-binary=${CLANG_TIDY} -p cmakebuild \
-checks='-*,modernize-use-emplace,modernize-avoid-bind,performance-*' \
-warningsaserrors='-*,modernize-use-emplace' \
-no-command-on-stdout -quiet \
files 'src/.*'
RET=$?
echo "Clang tidy returned $RET"
exit $RET