dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.56k stars 1.44k forks source link

Add support for Python linter called Darglint which checks for google style docstrings #2571

Open dhruvdcoder opened 5 years ago

dhruvdcoder commented 5 years ago

Name: darglint URL: https://github.com/terrencepreilly/darglint

It is useful if you want to autogenerate documentation using sphinx autodoc (it supports google style docstrings).

I got a simple version working using the following script. dhruvdcoder/darglint.vim

I am no vim expert and hence a bit apprehensive about add this through a pull request myself.

Krilivye commented 5 years ago

I am too interested :). Is there a documentation/example for integrating a new linter?

w0rp commented 5 years ago

The easiest way is to look at an existing linter for examples, and read :help ale#linter#Define() for explaining what all of the options do. :help ale-dev will take you to some documentation for ALE development.

mflova commented 2 years ago

I have just seen this tool and it is really really useful. However, with the current master branch, this script is no longer working. Are you still using it? Do you have any updated version?

dhruvdcoder commented 2 years ago

The script still works with Darglint's default message pattern {path}:{obj}:{line}: {msg_id}: {msg}. The key line is this regex. If you have changed the default message pattern for Darglint as shown here, then you will need to change the regex accordingly.

Hope this helps.

mflova commented 2 years ago

Thank you so much! I did not expect such quick response. Good to know it. However, in your .vim file, there is a function ale#path#CdString that is no longer used in the current version. It seems to be a function that was used in a few linters in order to execute a cd command in case it was necessary. I could check that in the current release, this function was removed and changed in all the files that were using it (commit: 9fe7b1fe6a23fb55e6d782293585d58193123f59). Due to this, I get an error as it cannot find the reference to this function. Are you using it with the last release/version? Do you know if this command is necessary before the darglint command is used?

Edit: For those who were wondering, here is the fix of this file for the current master version:

Then you can use your arguments in the vimrc file as let g:ale_python_darglint_options = ' --docstring-style sphinx'