[clang-tidy] move config to .clang-tidy file (#9308)

This commit is contained in:
Jonathan Hui
2023-07-24 11:45:18 -07:00
committed by GitHub
parent 34906f4a57
commit 1f1c155dc2
3 changed files with 41 additions and 49 deletions
+5 -35
View File
@@ -142,27 +142,6 @@ OT_CLANG_TIDY_BUILD_OPTS=(
)
readonly OT_CLANG_TIDY_BUILD_OPTS
OT_CLANG_TIDY_CHECKS="\
-*,\
google-explicit-constructor,\
google-readability-casting,\
misc-unused-using-decls,\
modernize-loop-convert,\
modernize-use-bool-literals,\
modernize-use-equals-default,\
modernize-use-equals-delete,\
modernize-use-nullptr,\
readability-avoid-const-params-in-decls,\
readability-else-after-return,\
readability-inconsistent-declaration-parameter-name,\
readability-make-member-function-const,\
readability-redundant-control-flow,\
readability-redundant-member-init,\
readability-simplify-boolean-expr,\
readability-static-accessed-through-instance,\
"
readonly OT_CLANG_TIDY_CHECKS
do_clang_format()
{
echo -e '========================================'
@@ -192,7 +171,7 @@ do_clang_tidy_fix()
(mkdir -p ./build/cmake-tidy \
&& cd ./build/cmake-tidy \
&& THREAD_VERSION=1.3 cmake "${OT_CLANG_TIDY_BUILD_OPTS[@]}" ../.. \
&& ../../script/clang-tidy -header-filter='.*' -checks="${OT_CLANG_TIDY_CHECKS}" -j"$OT_BUILD_JOBS" "${OT_CLANG_TIDY_FIX_DIRS[@]}" -fix)
&& ../../script/clang-tidy -j"$OT_BUILD_JOBS" "${OT_CLANG_TIDY_FIX_DIRS[@]}" -fix)
}
do_clang_tidy_check()
@@ -201,19 +180,10 @@ do_clang_tidy_check()
echo -e ' check c/c++ (clang-tidy)'
echo -e '========================================'
(
mkdir -p ./build/cmake-tidy \
&& cd ./build/cmake-tidy \
&& THREAD_VERSION=1.3 cmake "${OT_CLANG_TIDY_BUILD_OPTS[@]}" ../.. \
&& ../../script/clang-tidy -header-filter='.*' -checks="${OT_CLANG_TIDY_CHECKS}" -j"$OT_BUILD_JOBS" "${OT_CLANG_TIDY_FIX_DIRS[@]}" \
| grep -v -E "third_party" >output.txt
if grep -q "warning: \|error: " output.txt; then
echo "You must pass the clang tidy checks before submitting a pull request"
echo ""
grep --color -E 'warning: |error: ' -A 5 output.txt
exit 1
fi
)
(mkdir -p ./build/cmake-tidy \
&& cd ./build/cmake-tidy \
&& THREAD_VERSION=1.3 cmake "${OT_CLANG_TIDY_BUILD_OPTS[@]}" ../.. \
&& ../../script/clang-tidy -j"$OT_BUILD_JOBS" "${OT_CLANG_TIDY_FIX_DIRS[@]}")
}
do_markdown_format()