diff --git a/lua/guard-collection/linter/clang-tidy.lua b/lua/guard-collection/linter/clang-tidy.lua index abd2cb2..65d7225 100644 --- a/lua/guard-collection/linter/clang-tidy.lua +++ b/lua/guard-collection/linter/clang-tidy.lua @@ -3,6 +3,7 @@ local lint = require('guard.lint') return { cmd = 'clang-tidy', args = { '--quiet' }, + fname = true, parse = lint.from_regex({ source = 'clang-tidy', regex = ':(%d+):(%d+):%s+(%w+):%s+(.-)%s+%[(.-)%]', diff --git a/test/linter/helper.lua b/test/linter/helper.lua index cbe1d39..5606a10 100644 --- a/test/linter/helper.lua +++ b/test/linter/helper.lua @@ -6,14 +6,17 @@ M.namespace = api.nvim_get_namespaces().Guard function M.test_with(ft, input) local cmd = require('guard.filetype')(ft).linter[1].cmd assert(vim.fn.executable(cmd) == 1) + local bufnr = api.nvim_create_buf(true, false) vim.bo[bufnr].filetype = ft api.nvim_set_current_buf(bufnr) api.nvim_buf_set_lines(bufnr, 0, -1, false, input) -- To make linters happy vim.cmd('silent! write! /tmp/test.' .. ft) + lint.do_lint(bufnr) - vim.wait(5000) + vim.wait(3000) + vim.print(vim.diagnostic.get(bufnr)) return vim.diagnostic.get(bufnr) end