From 0304a0602e19b9ec4feb0d12a2cfb5a94e4cb237 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 26 Oct 2026 20:19:19 +0100 Subject: ide: improve clang-tidy integration --- .clang-tidy | 4 ---- CMakeLists.txt | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 6794ba6..bf5a3a7 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -62,10 +62,6 @@ CheckOptions: cppcoreguidelines-avoid-non-const-global-variables.AllowInternalLinkage: true - modernize-use-std-print.ReplacementPrintFunction: "kstd::print" - modernize-use-std-print.ReplacementPrintlnFunction: "kstd::println" - modernize-use-std-print.PrintHeader: "kstd/print" - modernize-use-std-ranges.UseReversePipe: true modernize-use-trailing-return-type.TransformLambdas: none diff --git a/CMakeLists.txt b/CMakeLists.txt index bdda024..0562c1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,15 @@ project("ttwhy" include("CTest") +### System Tools + +find_program(CLANG_TIDY_PATH NAMES + "clang-tidy" + "clang-tidy-22" + "clang-tidy-23" + "clang-tidy-24" +) + ### System Dependencies find_package("Threads") @@ -95,6 +104,16 @@ target_compile_options("ttwhy-core" PUBLIC "$<$:-pedantic-errors>" ) +if(CLANG_TIDY_PATH) + set_target_properties("ttwhy-core" PROPERTIES + CXX_CLANG_TIDY "${CLANG_TIDY_PATH}" + ) +else() + message(AUTHOR_WARNING + "clang-tidy not found; skipping linting for 'ttwhy::core'" + ) +endif() + ### Applications add_executable("ttwhy-echo") @@ -108,6 +127,16 @@ target_link_libraries("ttwhy-echo" PRIVATE "ttwhy::lib" ) +if(CLANG_TIDY_PATH) + set_target_properties("ttwhy-echo" PROPERTIES + CXX_CLANG_TIDY "${CLANG_TIDY_PATH}" + ) +else() + message(AUTHOR_WARNING + "clang-tidy not found; skipping linting for 'ttwhy::echo'" + ) +endif() + ### Tests if(BUILD_TESTING) -- cgit v1.2.3