Исправлено разрешение автоматического исправления ошибок для Clazy

This commit is contained in:
Andrei Astafev 2020-04-18 19:36:28 +03:00
parent afa8b1e295
commit 8d2809a772

View File

@ -1,23 +1,21 @@
set(clazy_checks
container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast
)
function(add_clazy_check target) function(add_clazy_check target)
set(_sources ${ARGN})
find_program(CLAZY_EXE NAMES clazy-standalone) find_program(CLAZY_EXE NAMES clazy-standalone)
set(_sources ${ARGN})
set(_clazy_checks
"container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast")
set(_args -checks=level2,${_clazy_checks} -extra-arg="-Wno-unknown-warning-option")
if(CLAZY_EXE) if(CLAZY_EXE)
if(NOT TARGET clazy-check) if(NOT TARGET clazy-check)
add_custom_target(clazy-check) add_custom_target(clazy-check)
endif() endif()
add_custom_target( add_custom_target(
clazy-check-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} clazy-check-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CLAZY_EXE} -checks=level2,${clazy_checks} -extra-arg="-Wno-unknown-warning-option" -p COMMAND ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${_sources})
${CMAKE_BINARY_DIR} ${_sources})
add_dependencies(clazy-check-${target} ${target}) add_dependencies(clazy-check-${target} ${target})
add_dependencies(clazy-check clazy-check-${target}) add_dependencies(clazy-check clazy-check-${target})
else() else()
message(STATUS "CMLIB warning:") message(STATUS "CMLIB warning:")
message(STATUS " Clazy analyzer is not found") message(STATUS " Clazy standalone analyzer is not found")
endif() endif()
endfunction() endfunction()