Skip to content

fix: clang-tidy #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test/clang_tidy.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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()

# ------------------------------------------------------------------------------
Expand Down