Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

Commit

Permalink
stylua bandit
Browse files Browse the repository at this point in the history
  • Loading branch information
qbedard committed Jan 14, 2023
1 parent 59b135e commit 84468e4
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions lua/null-ls/builtins/diagnostics/bandit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,49 @@ local null_ls = require("null-ls")
local helpers = require("null-ls.helpers")

return helpers.make_builtin({
name = "bandit",
meta = {
url = "https://github.com/PyCQA/bandit",
description = "Bandit is a tool designed to find common security issues in Python code.",
},
method = null_ls.methods.DIAGNOSTICS,
filetypes = { "python" },
generator = helpers.generator_factory({
command = "bandit",
name = "bandit",
args = {
"--format",
"json",
"-",
meta = {
url = "https://github.com/PyCQA/bandit",
description = "Bandit is a tool designed to find common security issues in Python code.",
},
to_stdin = true,
from_stderr = false,
ignore_stderr = true,
format = "json",
check_exit_code = { 0, 1 },
on_output = function(params)
local parse = helpers.diagnostics.from_json({
attributes = {
row = "line_number",
col = "col_offset",
code = "test_id",
message = "issue_text",
severity = "issue_severity",
method = null_ls.methods.DIAGNOSTICS,
filetypes = { "python" },
generator = helpers.generator_factory({
command = "bandit",
name = "bandit",
args = {
"--format",
"json",
"-",
},
offsets = { col = 1 },
severities = {
HIGH = helpers.diagnostics.severities["error"],
MEDIUM = helpers.diagnostics.severities["warning"],
LOW = helpers.diagnostics.severities["information"],
},
})
to_stdin = true,
from_stderr = false,
ignore_stderr = true,
format = "json",
check_exit_code = { 0, 1 },
on_output = function(params)
local parse = helpers.diagnostics.from_json({
attributes = {
row = "line_number",
col = "col_offset",
code = "test_id",
message = "issue_text",
severity = "issue_severity",
},
offsets = { col = 1 },
severities = {
HIGH = helpers.diagnostics.severities["error"],
MEDIUM = helpers.diagnostics.severities["warning"],
LOW = helpers.diagnostics.severities["information"],
},
})

if params.output then
params.output = params.output.results
return parse(params)
end
if params.output then
params.output = params.output.results
return parse(params)
end

return {}
end,
}),
return {}
end,
}),
})

0 comments on commit 84468e4

Please sign in to comment.