diff --git a/README.md b/README.md index 6f128ef..b71a578 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ - [x] [black](https://github.com/psf/black) - [x] [cbfmt](https://github.com/lukas-reineke/cbfmt) - [x] [clang-format](https://www.kernel.org/doc/html/latest/process/clang-format.html) +- [ ] [codespell](https://github.com/codespell-project/codespell) - [ ] [djhtml](https://github.com/rtts/djhtml) - [ ] [fish_indent](https://fishshell.com/docs/current/cmds/fish_indent.html) - [ ] [fnlfmt](https://git.sr.ht/~technomancy/fnlfmt) diff --git a/lua/guard-collection/linter/codespell.lua b/lua/guard-collection/linter/codespell.lua new file mode 100644 index 0000000..1ccf916 --- /dev/null +++ b/lua/guard-collection/linter/codespell.lua @@ -0,0 +1,20 @@ +local lint = require('guard.lint') +return { + cmd = 'codespell', + args = { + '-', + }, + stdin = true, + parse = function(result, bufnr) + local diags = {} + local t = vim.split(result, '\n') + for i, e in ipairs(t) do + local lnum = e:match('^%d+') + if lnum then + diags[#diags + 1] = + lint.diag_fmt(bufnr, tonumber(lnum) - 1, 0, t[i + 1]:gsub('\t', ''), 2, 'codespell') + end + end + return diags + end, +}