1
0
Fork 0
cuberite-2a/clang-tidy.sh

26 lines
746 B
Bash
Raw Normal View History

#!/bin/sh
set -e
FIXES_FILE="tidy-fixes.yaml"
REGEX="/cuberite/src/\.?[^\.]"
2018-08-25 10:25:21 +00:00
ARGS="-header-filter $REGEX -quiet -export-fixes $FIXES_FILE "$@" $REGEX"
# Generate the compilation database
mkdir -p tidy-build
cd tidy-build
# Disable precompiled headers since they aren't generated during linting which causes an error
# Disable unity builds since clang-tidy needs the full list of compiled files to check each one
2020-05-21 22:52:19 +00:00
cmake --target Cuberite -DCMAKE_EXPORT_COMPILE_COMMANDS=Yes -DPRECOMPILE_HEADERS=No -DUNITY_BUILDS=No ..
# Ensure LuaState_Typedefs.inc has been generated
(cd ../src/Bindings && lua BindingsProcessor.lua)
2020-05-08 19:18:51 +00:00
if run-clang-tidy $ARGS; then
echo "clang-tidy: No violations found"
else
echo "clang-tidy: Found violations"
exit 1
fi