Skip to content

Commit

Permalink
chore: unretire puppet_lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mochaaP committed Mar 1, 2024
1 parent e6d3abf commit 6f07f57
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
42 changes: 42 additions & 0 deletions lua/null-ls/builtins/diagnostics/puppet_lint.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
local h = require("null-ls.helpers")
local methods = require("null-ls.methods")

local severities = {
error = vim.lsp.protocol.DiagnosticSeverity.Error,
warning = vim.lsp.protocol.DiagnosticSeverity.Warning,
}

return h.make_builtin({
name = "puppet-lint",
meta = {
url = "http://puppet-lint.com/",
description = "Check that your Puppet manifest conforms to the style guide.",
},
method = methods.internal.DIAGNOSTICS,
filetypes = { "puppet", "epuppet" },
generator_opts = {
command = "puppet-lint",
args = { "--json", "$FILENAME" },
format = "json",
check_exit_code = function(code)
return code <= 1
end,
on_output = function(params)
local diags = {}
for _, d in ipairs(params.output) do
for _, f in ipairs(d) do
table.insert(diags, {
row = f.line,
col = f.column,
source = f.check,
message = f.message,
severity = severities[f.kind],
filename = f.fullpath,
})
end
end
return diags
end,
},
factory = h.generator_factory,
})
23 changes: 23 additions & 0 deletions lua/null-ls/builtins/formatting/puppet_lint.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
local h = require("null-ls.helpers")
local methods = require("null-ls.methods")

local FORMATTING = methods.internal.FORMATTING

return h.make_builtin({
name = "puppet-lint",
meta = {
url = "http://puppet-lint.com/",
description = "Check that your Puppet manifest conforms to the style guide",
},
method = FORMATTING,
filetypes = { "puppet", "epuppet" },
generator_opts = {
command = "puppet-lint",
args = {
"--fix",
"$FILENAME",
},
to_temp_file = true,
},
factory = h.formatter_factory,
})

0 comments on commit 6f07f57

Please sign in to comment.