integrate clang-tidy into cmake
All checks were successful
continuous-integration/drone/push Build is passing

* consolidate everything with the makefile, the "tidy" target now just
  sets the env var that is checked for in CMakeLists
* rm clang-tidy from pre-commit as it's run as part of the "test"
  makefile target later in the file anyway
This commit is contained in:
surtur 2021-12-05 05:07:02 +01:00
parent 53645ea160
commit 7f05984946
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
3 changed files with 7 additions and 6 deletions

View File

@ -13,9 +13,6 @@ repos:
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.4
hooks:
- id: clang-tidy
args: ["-p", "cmake-build-debug"]
exclude: ^lib/
- id: cppcheck
args: ["--language=c++", "--std=c++20",
"--enable=warning,performance,portability,information,unusedFunction,missingInclude",

View File

@ -28,6 +28,12 @@ add_subdirectory(lib/fmt EXCLUDE_FROM_ALL)
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
if(CMAKE_BUILD_TYPE MATCHES "Debug")
if($ENV{TIDY} MATCHES "1")
set(CMAKE_CXX_CLANG_TIDY clang-tidy -p ${CMAKE_CURRENT_BINARY_DIR} --checks=-*,clang-diagnostic-*,clang-analyzer-*,google-*,bugprone-* --header-filter= --use-color=true)
endif()
# Produce debugging information in the operating system's native format.
# Level 3 includes extra information, such as all the macro definitions
# present in the program. Some debuggers support macro expansion when you

View File

@ -9,8 +9,6 @@ d_folder = cmake-build-debug
r_folder = cmake-build-release
s_folder = cmake-build-san
s_tru = SANITIZE_PLS=true
t = clang-tidy
t_args = --config="" --format-style=google --checks="clang-diagnostic-*,clang-analyzer-*,google-*" --use-color=true -p $(d_folder) ./*.{cpp,h}
v = valgrind
v_env = VALGRIND=
v_db = $(d_folder)_valgr
@ -41,7 +39,7 @@ san:
tidy:
$(t) $(t_args)
env TIDY=1 make debug
valgrind: valgrind-debug