Allow multiple errors in CI

This commit is contained in:
Stephan Seitz 2021-03-04 13:56:40 +01:00 committed by Kiyan
parent e32029460d
commit 9b6b2543e8
2 changed files with 17 additions and 12 deletions

View file

@ -134,9 +134,6 @@
"teal": {
"revision": "fc73205515276be4ff95dfc5daa0fc67e18bfbde"
},
"test": {
"revision": "b76dd0d07f66dac5abf4641cab7a1d6067039b7f"
},
"toml": {
"revision": "084da152d85cb8c4bbbe0ab5f3f1f9e5bfb77d3c"
},

View file

@ -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