Add clang-tidy to build_tools/lint.fish

This commit is contained in:
Lior Stern 2020-04-01 19:33:31 +03:00 committed by ridiculousfish
parent 321e1ed26a
commit d7aeac3c61
2 changed files with 12 additions and 3 deletions

View file

@ -10,6 +10,7 @@ endif()
include(cmake/Mac.cmake)
project(fish)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# We are C++11.
set(CMAKE_CXX_STANDARD 11)
@ -217,11 +218,11 @@ include(cmake/MacApp.cmake)
# CMake does not support the "iquote" flag - https://gitlab.kitware.com/cmake/cmake/issues/15491
set(LINT_ARGS "-D$<JOIN:$<TARGET_PROPERTY:fishlib,COMPILE_DEFINITIONS>, -D>" "-I$<JOIN:$<TARGET_PROPERTY:fishlib,INCLUDE_DIRECTORIES>, -I>")
add_custom_target(lint
COMMAND build_tools/lint.fish -- ${LINT_ARGS}
COMMAND build_tools/lint.fish -p ${CMAKE_BINARY_DIR} -- ${LINT_ARGS}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
add_custom_target(lint-all
COMMAND build_tools/lint.fish --all -- ${LINT_ARGS}
COMMAND build_tools/lint.fish --all -p ${CMAKE_BINARY_DIR} -- ${LINT_ARGS}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)

View file

@ -13,7 +13,7 @@ set all no
set kernel_name (uname -s)
set machine_type (uname -m)
argparse a/all -- $argv
argparse a/all p/project= -- $argv
# We only want -D and -I options to be passed thru to cppcheck.
for arg in $argv
@ -117,6 +117,14 @@ if set -q c_files[1]
# output will expect those messages to be written to stdout.
oclint $c_files -- $argv 2>&1
end
if type -q clang-tidy; and set -q _flag_project
echo
echo ========================================
echo Running clang-tidy
echo ========================================
clang-tidy -p $_flag_project $c_files
end
else
echo
echo 'WARNING: No C/C++ files to check'