Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[contribute: darglint] #180

Closed
1 task done
aemonge opened this issue Sep 5, 2024 · 3 comments
Closed
1 task done

[contribute: darglint] #180

aemonge opened this issue Sep 5, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@aemonge
Copy link

aemonge commented Sep 5, 2024

Issues

  • I have checked existing issues and there are no existing ones with the same request.

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),
            },
        })
@aemonge aemonge added the enhancement New feature or request label Sep 5, 2024
@jakenvac
Copy link
Collaborator

jakenvac commented Sep 5, 2024

Feel free to submit a pull request with this!

@aemonge
Copy link
Author

aemonge commented Sep 6, 2024

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

  • How should I test it?
  • Should I set / use unit test?
  • Where should I put it ?

Is there a guide for contributing?

@mochaaP mochaaP added the good first issue Good for newcomers label Sep 7, 2024
@aemonge
Copy link
Author

aemonge commented Sep 12, 2024

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

And made this PR -> #181

@aemonge aemonge closed this as completed Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants