Closed LinqLover closed 2 years ago
Has this already been discussed in this repository?
To varying degrees it has, usually while discussing other codes https://github.com/PyCQA/pydocstyle/issues?q=is%3Aissue+d202
There is a misunderstanding of PEP257. It mentions, that after a class docstring there should be a blank line before the first method.
An example for this would be:
class Foo:
"""
My wonderful class docstring. A blank line shall follow.
"""
def first_method(self):
...
I think this can be closed.
Why would an empty line outside of docstrings be of any concern for pydocstyle?
Because the tool tries to implement the style recommendations of PEP 257 which if look a few comments above describes whitespace around the docstring.
There’s no blank line either before or after the docstring.
This note from PEP 257 is mentioned in relation to one-line docstrings. It is not obvious it applies to multi-line strings.
I'm not here to debate arbitrary excerpts from a document that's likely evolved since this tool was created. You asked a snarky and bad faith question about why this tool cares, I answered you. This tool has backwards compatibility guarantees and so trying to keep up with the fickle desires of the PEP editors isn't entirely plausible, it's why checks can be disabled or enabled at will.
PEP257 says:
(emphasis mine)
As I understand this, every method containing a docstring should be formatted like this:
However, this raises "D202 No blank lines allowed after function docstring". I could suppress this warning, but instead, I would like to get an error if I miss the newline after docstring:
Has this already been discussed in this repository? Would it be possible to add an option for being warned about such missing newlines?