aboutsummaryrefslogtreecommitdiff
path: root/cmake/RunLuacheck.cmake
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-12-03 16:49:30 +0300
committerZyX <kp-pav@yandex.ru>2017-12-03 16:49:30 +0300
commitc49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57 (patch)
treeb7e59c416d1435725c65f8952b6e55c70544d97e /cmake/RunLuacheck.cmake
parent62108c3b0be46936c83f6d4c98b44ceb5e6f77fd (diff)
parent27a577586eace687c47e7398845178208cae524a (diff)
downloadrneovim-c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57.tar.gz
rneovim-c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57.tar.bz2
rneovim-c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57.zip
Merge branch 'master' into s-dash-stdin
Diffstat (limited to 'cmake/RunLuacheck.cmake')
-rw-r--r--cmake/RunLuacheck.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/RunLuacheck.cmake b/cmake/RunLuacheck.cmake
new file mode 100644
index 0000000000..5129541cd8
--- /dev/null
+++ b/cmake/RunLuacheck.cmake
@@ -0,0 +1,22 @@
+set(LUACHECK_ARGS -q "${LUAFILES_DIR}")
+if(DEFINED IGNORE_PATTERN)
+ list(APPEND LUACHECK_ARGS --exclude-files "${LUAFILES_DIR}/${IGNORE_PATTERN}")
+endif()
+if(DEFINED CHECK_PATTERN)
+ list(APPEND LUACHECK_ARGS --include-files "${LUAFILES_DIR}/${CHECK_PATTERN}")
+endif()
+if(DEFINED READ_GLOBALS)
+ list(APPEND LUACHECK_ARGS --read-globals "${READ_GLOBALS}")
+endif()
+
+execute_process(
+ COMMAND "${LUACHECK_PRG}" ${LUACHECK_ARGS}
+ WORKING_DIRECTORY "${LUAFILES_DIR}"
+ ERROR_VARIABLE err
+ RESULT_VARIABLE res
+)
+
+if(NOT res EQUAL 0)
+ message(STATUS "Output to stderr:\n${err}")
+ message(FATAL_ERROR "Linting tests failed with error: ${res}.")
+endif()