diff --git a/.github/workflows/test/clang_tidy.sh b/.github/workflows/test/clang_tidy.sh index 832423db..8508d2dc 100644 --- a/.github/workflows/test/clang_tidy.sh +++ b/.github/workflows/test/clang_tidy.sh @@ -1,7 +1,7 @@ #!/bin/bash # run clang tidy -cmake -DENABLE_CLANG_TIDY=ON . +cmake -DENABLE_CLANG_TIDY=ON -DUNIT_TEST=ON . make tidy > output.txt #if [[ -n $(grep "warning: " output.txt) ]] || [[ -n $(grep "error: " output.txt) ]]; then # for now only fail the test on errors. Change this as project matures diff --git a/CMakeLists.txt b/CMakeLists.txt index cdd7d5ea..dc18b910 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,9 +34,8 @@ endif() # ------------------------------------------------------------------------------ if(ENABLE_CLANG_TIDY) - - find_program(CLANG_TIDY_BIN clang-tidy-6.0) - find_program(RUN_CLANG_TIDY_BIN run-clang-tidy-6.0.py) + find_program(CLANG_TIDY_BIN clang-tidy-5.0) + find_program(RUN_CLANG_TIDY_BIN run-clang-tidy-5.0.py) if(CLANG_TIDY_BIN STREQUAL "CLANG_TIDY_BIN-NOTFOUND") message(FATAL_ERROR "unable to locate clang-tidy-5.0") @@ -47,14 +46,13 @@ if(ENABLE_CLANG_TIDY) endif() list(APPEND RUN_CLANG_TIDY_BIN_ARGS - -clang-tidy-binary ${CLANG_TIDY_BIN} - "\"-header-filter=.*\\b(src|test|examples)\\b\\/(?!lib).*\"" #Only run clang tidy on src, test, examples and skip 3rd party libraries - -checks=clan*,cert*,misc*,perf*,cppc*,read*,mode*,-cert-err58-cpp,-misc-noexcept-move-constructor,-cppcoreguidelines-*) + -clang-tidy-binary ${CLANG_TIDY_BIN} + -header-filter="\".*\\b(cpp-client/src)\"" + -checks=clan*,cert*,misc*,perf*,cppc*,read*,mode*,-cert-err58-cpp,-misc-noexcept-move-constructor,-cppcoreguidelines-*) add_custom_target(tidy COMMAND ${RUN_CLANG_TIDY_BIN} ${RUN_CLANG_TIDY_BIN_ARGS} COMMENT "running clang tidy") - endif() # ------------------------------------------------------------------------------