https://pantsbuild.org/ logo
#general
Title
# general
r

refined-addition-53644

07/22/2022, 2:34 PM
Hi, Is there any plan to add pydocstyle as a linter? I was thinking of contributing.
w

wide-midnight-78598

07/22/2022, 2:35 PM
Question: How is this different than
docformatter
? I've never used pydocstyle
r

refined-addition-53644

07/22/2022, 2:36 PM
docformatter currently automatically formats docstrings to follow a subset of the PEP 257 conventions. Below are the relevant items quoted from PEP 257.
As far as I understand it will just format the existing docstring but not complain about missing ones
w

wide-midnight-78598

07/22/2022, 2:37 PM
Oh, I thought it did... Oh, hmm, maybe I'm thinking of pylint or one of the other linters
r

refined-addition-53644

07/22/2022, 2:38 PM
I also thought initially that docformatter was enough. But then saw people adding no docstring and realized that we need some other linting tool to catch missing docstring
For now I have added pydocstyle to our pre-commit-config outside of pants. So it works.
b

bitter-ability-32190

07/22/2022, 2:39 PM
r

refined-addition-53644

07/22/2022, 2:40 PM
So you added it as a flake8 plugin ? @bitter-ability-32190
b

bitter-ability-32190

07/22/2022, 2:41 PM
Yes, add that library and also if you want to, pin the version of
pydocstyle
w

wide-midnight-78598

07/22/2022, 2:43 PM
Also, doesn't this come with pylint? I remember being annoyed by missing doc complaints by one of the tools on some sample code I wrote. Thought it was pylint https://pylint.pycqa.org/en/latest/user_guide/messages/convention/missing-module-docstring.html
r

refined-addition-53644

07/22/2022, 2:46 PM
By the way where do you add the config for the plugin. So for flake8-pydocstyle, I should add it in my flake8 config, right? For pydocstyle, that would be
Copy code
[pydocstyle]
inherit=false
add_ignore=D100,D105,D107,D203,D401,D405,D415
match=^((?!(test|__init__)).)*$
ignore_decorators=app.exception_handler
b

bitter-ability-32190

07/22/2022, 2:47 PM
Yes to adding it to flake8 config. I think the plugin copies all the config entries though. You'll have to play around with it
h

happy-kitchen-89482

07/22/2022, 3:01 PM
That said, we'd have no objection that I can think of to adding it as a standalone linter!
b

busy-vase-39202

07/22/2022, 4:38 PM
+1 we welcome contributions to core, and this sounds like an addition that other folks would appreciate having.