mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-11-26 05:31:36 +00:00
feat(tidy): add fairmq-clangd for editor integration
- Add the option BUILD_TIDY_CLANGD (default OFF). It builds fairmq-clangd from clangdMain plus the fairmq-* module. - clangd cannot load plugins, but creates its clang-tidy checks from the same registry. Thus the checks run on the AST that clangd builds anyway, and editors show their fixes as quick fixes. - Point clangd to the resource directory of the LLVM installation it was built with, unless --resource-dir is given. - Test each check over LSP with test/tidy/ClangdCheck.py: open the input, expect a diagnostic of the check and a quick fix for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,13 @@ if(NOT FAIRMQ_TIDY_CLANG_TIDY)
|
||||
"Skipping the fairmq-tidy plugin tests.")
|
||||
endif()
|
||||
|
||||
if(BUILD_TIDY_CLANGD)
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
if(NOT Python3_FOUND)
|
||||
message(STATUS "Python 3 not found. Skipping the fairmq-clangd tests.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(GLOB inputs CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/fairmq-*.cxx")
|
||||
foreach(input IN LISTS inputs)
|
||||
get_filename_component(check "${input}" NAME_WE)
|
||||
@@ -67,4 +74,14 @@ foreach(input IN LISTS inputs)
|
||||
)
|
||||
set_tests_properties("tidy.plugin.${check}" PROPERTIES TIMEOUT 120)
|
||||
endif()
|
||||
|
||||
if(BUILD_TIDY_CLANGD AND Python3_FOUND)
|
||||
add_test(NAME "tidy.clangd.${check}"
|
||||
COMMAND Python3::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/ClangdCheck.py"
|
||||
"$<TARGET_FILE:FairMQ::fairmq-clangd>" "${check}" "${input}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/flags.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/clangd/${check}"
|
||||
)
|
||||
set_tests_properties("tidy.clangd.${check}" PROPERTIES TIMEOUT 120)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
Reference in New Issue
Block a user