Skip to content

Commit 43a89a4

Browse files
authored
builtins/npm-groovy-lint: fix diagnostics not parsed (#224)
1 parent 08744d5 commit 43a89a4

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

lua/null-ls/builtins/diagnostics/npm_groovy_lint.lua

+19-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local errors_to_diagnostic = function(error)
77
-- initial diagnostic
88
diagnostic = {
99
message = error.msg,
10-
ruleId = error.id,
10+
ruleId = error.rule,
1111
level = error.severity,
1212
line = error.line,
1313
}
@@ -35,8 +35,8 @@ end
3535

3636
local handle_npm_groovy_lint_output = function(params)
3737
if params.output and params.output.files then
38-
-- "0" is the first file in the output.files table. not an array
39-
local file = params.output.files["0"]
38+
local file_key = vim.tbl_keys(params.output.files)[1]
39+
local file = params.output.files[file_key]
4040
if file and file.errors then
4141
local parser = h.diagnostics.from_json({
4242
severities = {
@@ -66,8 +66,22 @@ return h.make_builtin({
6666
filetypes = { "groovy", "java", "Jenkinsfile" },
6767
generator_opts = {
6868
command = "npm-groovy-lint",
69-
args = { "-o", "json", "-" },
70-
to_stdin = true,
69+
args = function(params)
70+
local args = {
71+
"--failon",
72+
"none",
73+
"-o",
74+
"json",
75+
"$FILENAME",
76+
}
77+
if params.bufname:find("Jenkinsfile") then
78+
-- https://github.com/nvuillam/npm-groovy-lint/issues/422#issuecomment-2324321544
79+
table.insert(args, #args, "--no-parse")
80+
end
81+
return args
82+
end,
83+
to_stdin = false,
84+
to_temp_file = true,
7185
from_stderr = false,
7286
ignore_stderr = true,
7387
format = "json_raw",

0 commit comments

Comments
 (0)