integrate clang-tidy into cmake
All checks were successful
continuous-integration/drone/push Build is passing
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:
parent
53645ea160
commit
7f05984946
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
4
Makefile
4
Makefile
|
@ -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
|
||||
|
||||
|
|
Reference in New Issue