mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Linting: Integrate into CMake, enable by default.
This commit is contained in:
committed by
Justin M. Keyes
parent
aa08632caf
commit
e21f6e754d
21
cmake/RunLint.cmake
Normal file
21
cmake/RunLint.cmake
Normal file
@@ -0,0 +1,21 @@
|
||||
get_filename_component(LINT_DIR ${LINT_DIR} ABSOLUTE)
|
||||
get_filename_component(LINT_PREFIX ${LINT_DIR} PATH)
|
||||
file(GLOB_RECURSE LINT_FILES ${LINT_DIR}/*.c ${LINT_DIR}/*.h)
|
||||
|
||||
if(LINT_IGNORE_FILE)
|
||||
file(READ ${LINT_IGNORE_FILE} LINT_IGNORED_FILES)
|
||||
string(REPLACE "\n" ";" LINT_IGNORED_FILES ${LINT_IGNORED_FILES})
|
||||
message(STATUS "Ignoring the following files for linting:")
|
||||
foreach(ignore_file ${LINT_IGNORED_FILES})
|
||||
message(STATUS "${ignore_file}")
|
||||
list(REMOVE_ITEM LINT_FILES "${LINT_PREFIX}/${ignore_file}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LINT_PRG} ${LINT_FILES}
|
||||
RESULT_VARIABLE res)
|
||||
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "Linting failed: ${res}.")
|
||||
endif()
|
||||
Reference in New Issue
Block a user