From d48d88e4561c074ec6e8a3d809e6ca5fea323478 Mon Sep 17 00:00:00 2001 From: xiaoshihou Date: Mon, 9 Dec 2024 07:42:58 +0000 Subject: [PATCH] fix: clang-tidy --- lua/guard-collection/linter/clang-tidy.lua | 1 + test/linter/helper.lua | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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