2018-05-06 13:07:34 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
FIXES_FILE="tidy-fixes.yaml"
|
2021-06-15 05:00:02 -04:00
|
|
|
REGEX="cuberite_[^/\.]+/src/\.?[^\.]"
|
2018-08-25 06:25:21 -04:00
|
|
|
ARGS="-header-filter $REGEX -quiet -export-fixes $FIXES_FILE "$@" $REGEX"
|
2018-05-06 13:07:34 -04:00
|
|
|
|
2020-05-14 18:15:35 -04:00
|
|
|
# Generate the compilation database
|
2018-05-06 13:07:34 -04:00
|
|
|
mkdir -p tidy-build
|
|
|
|
cd tidy-build
|
2020-05-16 15:59:10 -04:00
|
|
|
|
|
|
|
# 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 18:52:19 -04:00
|
|
|
cmake --target Cuberite -DCMAKE_EXPORT_COMPILE_COMMANDS=Yes -DPRECOMPILE_HEADERS=No -DUNITY_BUILDS=No ..
|
2018-05-06 13:07:34 -04:00
|
|
|
|
2020-05-14 18:15:35 -04:00
|
|
|
# Ensure LuaState_Typedefs.inc has been generated
|
|
|
|
(cd ../src/Bindings && lua BindingsProcessor.lua)
|
|
|
|
|
2020-05-08 15:18:51 -04:00
|
|
|
if run-clang-tidy $ARGS; then
|
2018-05-06 13:07:34 -04:00
|
|
|
echo "clang-tidy: No violations found"
|
|
|
|
else
|
|
|
|
echo "clang-tidy: Found violations"
|
|
|
|
exit 1
|
|
|
|
fi
|