RunLuacheck.cmake 651 B

1234567891011121314151617181920212223
  1. set(LUACHECK_ARGS -q "${LUAFILES_DIR}")
  2. if(DEFINED IGNORE_PATTERN)
  3. list(APPEND LUACHECK_ARGS --exclude-files "${LUAFILES_DIR}/${IGNORE_PATTERN}")
  4. endif()
  5. if(DEFINED CHECK_PATTERN)
  6. list(APPEND LUACHECK_ARGS --include-files "${LUAFILES_DIR}/${CHECK_PATTERN}")
  7. endif()
  8. if(DEFINED READ_GLOBALS)
  9. list(APPEND LUACHECK_ARGS --read-globals "${READ_GLOBALS}")
  10. endif()
  11. execute_process(
  12. COMMAND "${LUACHECK_PRG}" ${LUACHECK_ARGS}
  13. WORKING_DIRECTORY "${LUAFILES_DIR}"
  14. ERROR_VARIABLE err
  15. RESULT_VARIABLE res
  16. )
  17. if(NOT res EQUAL 0)
  18. message(STATUS "Output to stderr:\n${err}")
  19. message(FATAL_ERROR "Linting tests failed with error: ${res}")
  20. endif()