From 5cda078dbecd14a3b3290008d8a2cc12a2656107 Mon Sep 17 00:00:00 2001 From: Navee <77710362+DinDjarins@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:01:16 +0530 Subject: [PATCH] Add svlint (#670) --- README.md | 4 +++- lua/lint/linters/svlint.lua | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 lua/lint/linters/svlint.lua diff --git a/README.md b/README.md index e73cd719..d73c6471 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,7 @@ Other dedicated linters that are built-in are: | [StandardRB][27] | `standardrb` | | [statix check][33] | `statix` | | [stylelint][29] | `stylelint` | +| [svlint][svlint] | `svlint` | | [SwiftLint][swiftlint] | `swiftlint` | | [systemd-analyze][systemd-analyze] | `systemd-analyze` | | [systemdlint][systemdlint] | `systemdlint` | @@ -577,4 +578,5 @@ busted tests/ [systemd-analyze]: https://man.archlinux.org/man/systemd-analyze.1 [awk]: https://www.gnu.org/software/gawk/ [yq]: https://mikefarah.gitbook.io/yq -[slang]: https://github.com/MikePopoloski/slang +[svlint]: https://github.com/dalance/svlint +[slang]: https://github.com/MikePopoloski/slang \ No newline at end of file diff --git a/lua/lint/linters/svlint.lua b/lua/lint/linters/svlint.lua new file mode 100644 index 00000000..59870655 --- /dev/null +++ b/lua/lint/linters/svlint.lua @@ -0,0 +1,17 @@ +local pattern = ".*(Fail)......([^:]+):(%d+):(%d+).*hint: (.+)%." +local groups = { "severity", "file", "lnum", "col", "message" } + +local severities = { + ["Fail"] = vim.diagnostic.severity.WARN, +} + +return { + cmd = "svlint", + stdin = false, + stream = "stdout", + args = { + "--oneline", + }, + ignore_exitcode = true, + parser = require("lint.parser").from_pattern(pattern, groups, severities, { ["source"] = "svlint" }), +}