From 9b6b2543e88212ea9eafac6c6fd910ddd56cc445 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Thu, 4 Mar 2021 13:56:40 +0100 Subject: Allow multiple errors in CI --- scripts/check-queries.lua | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/check-queries.lua b/scripts/check-queries.lua index aee0089e7..97960e323 100755 --- a/scripts/check-queries.lua +++ b/scripts/check-queries.lua @@ -26,24 +26,32 @@ local function do_check() local query_types = queries.built_in_query_groups local captures = extract_captures() + local last_error for _, lang in pairs(parsers) do for _, query_type in pairs(query_types) do print('Checking '..lang..' '..query_type) - local query = queries.get_query(lang, query_type) - - if query then - for _, capture in ipairs(query.captures) do - if not vim.startswith(capture, "_") -- We ignore things like _helper - and captures[query_type] - and not capture:find("^[A-Z]") -- Highlight groups - and not vim.tbl_contains(captures[query_type], capture) then - error(string.format("Invalid capture @%s in %s for %s.", capture, query_type, lang)) + local ok, query = pcall(queries.get_query,lang, query_type) + if not ok then + vim.api.nvim_err_writeln(query) + last_error = query + else + if query then + for _, capture in ipairs(query.captures) do + if not vim.startswith(capture, "_") -- We ignore things like _helper + and captures[query_type] + and not capture:find("^[A-Z]") -- Highlight groups + and not vim.tbl_contains(captures[query_type], capture) then + error(string.format("Invalid capture @%s in %s for %s.", capture, query_type, lang)) + end end end end end end + if last_error then + error(last_error) + end end -- cgit v1.2.3-70-g09d2