nvimtools / none-ls.nvim

null-ls.nvim reloaded / Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
The Unlicense
2.44k stars 73 forks source link

[contribute: darglint] #180

Closed aemonge closed 5 days ago

aemonge commented 1 week ago

Issues

Feature description

I want to help to contribute with darglint in python.

Help

Yes

Implementation help

local function darglint(null_ls)
    return {
        name = "darglint",
        method = null_ls.methods.DIAGNOSTICS,
        filetypes = { "python" },
        generator = null_ls.generator({
            command = "darglint",
            args = function(params)
                return {
                    "--message-template",
                    "{path}:{line}:{msg_id}:{msg}",
                    params.bufname
                }
            end,
            format = "line",
            check_exit_code = function(code, stderr)
                local success = code <= 1
                if not success then
                    vim.notify("darglint failed: " .. stderr, vim.log.levels.WARN)
                end
                return success
            end,
            on_output = function(line, params)
                local path, row, code, message = line:match("(.+):(%d+):(%w+):(.+)")
                if not path then
                    vim.notify("Failed to parse darglint output: " .. line, vim.log.levels.WARN)
                    return nil
                end

                row = tonumber(row) or 0

                return {
                    row = row + 1,
                    col = 1,
                    source = "darglint",
                    code = code,
                    message = message,
                    severity = 2, -- Warning
                }
            end,
        }),
    }
end
        null_ls.setup({
            sources = {
                darglint(null_ls),
            },
        })
jakenvac commented 1 week ago

Feel free to submit a pull request with this!

aemonge commented 1 week ago

Hi @jakenvac, I would need a bit of a guide. Mostly to know:

Is there a guide for contributing?

aemonge commented 5 days ago

I've "deprecated" darglint, favoring https://github.com/jsh9/pydoclint

And made this PR -> https://github.com/nvimtools/none-ls.nvim/pull/181