You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pydocstyle match configuration is not respected #159
Hi, forgive me if this is ultimately user error, but I'm trying to configure pydocstyle using my lsp client, so that I can get docstyle lints in general, for python files not associated to a specific project (which will hopefully prompt me to document one-off scripts better).
I'm using this config (emacs):
(setq eglot-workspace-configuration
'((pylsp
(plugins
(pydocstyle
(enabled .t)
(match.".*"))
(pycodestyle
;; Make compatible with black:;; https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length
(maxLineLength .88)
;; Only E203 is incompatible with black and enabled by;; default, but defining *any* ignore list will override;; the default ignore list, so we need to recreate the;; original.;;;; See also the small caveat under the huge table here:;; https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
(ignore. ["E203""E121""E123""E126""E133""E226""E241""E242""E704""W503""W504""W505"]))))))
The important part being the match setting for pydocstyle - as I understand it, this should make pydocstyle lint on any file name. However, testing a file named system-update (one-off script, conforming with Google's style guide regarding python file names), does not result in any linting, whereas testing a file named module.pydoes.
I think this is not a configuration issue, since all the other configuration works, including enabling pydocstyle. I also don't think my match is wrong - I've double checked it against python's re.match, and it's honestly simple enough I don't see how it can be wrong.
It doesn't look like you are setting that variable as Eglot expects which could be the source of your issue - see the manual here. Note, the form you have may have been acceptable by Eglot at one point when it allowed different forms before settling on the one in the manual. An alternative is to use a .dir-locals.el file at the root of your project. You can find a complete file for pylsphere.
This form continues to work for everything except pydocstyle. If you're referring to the : prefixes, iirc those aren't actually required if you prepare the data correctly. I forget the details, but I looked into how the elisp->json library works to get this, and even evaled the data to see what comes out at the other end.
But indeed, it has been a long time since I last dug into this, I'll give it another shot.
.dir-locals.el isn't an option if I want this to work in general, since it won't apply to scripts not in directories with these directory local variables, kind of defying the purpose of a default config.
.dir-locals.el isn't an option if I want this to work in general, since it won't apply to scripts not in directories with these directory local variables, kind of defying the purpose of a default config.
Right, and I believe the Eglot author suggests to use tool related config files where possible so a pyproject.toml in this case if possible. You might also want to consider python-lsp-ruff.
Activity
doolio commentedon Nov 2, 2023
It doesn't look like you are setting that variable as Eglot expects which could be the source of your issue - see the manual here. Note, the form you have may have been acceptable by Eglot at one point when it allowed different forms before settling on the one in the manual. An alternative is to use a
.dir-locals.elfile at the root of your project. You can find a complete file forpylsphere.TLATER commentedon Nov 10, 2023
This form continues to work for everything except pydocstyle. If you're referring to the
:prefixes, iirc those aren't actually required if you prepare the data correctly. I forget the details, but I looked into how the elisp->json library works to get this, and even evaled the data to see what comes out at the other end.But indeed, it has been a long time since I last dug into this, I'll give it another shot.
.dir-locals.elisn't an option if I want this to work in general, since it won't apply to scripts not in directories with these directory local variables, kind of defying the purpose of a default config.doolio commentedon Nov 10, 2023
Right, and I believe the Eglot author suggests to use tool related config files where possible so a
pyproject.tomlin this case if possible. You might also want to considerpython-lsp-ruff.