Open adamjstewart opened 1 year ago
Note that the issue disappears if the comment is removed. Black still reformats the function, but pydocstyle is okay with it with or without the newline. This leads me to believe this is a problem with pydocstyle.
I'm facing the same issue. AIUI this was previously raised with #361 and addressed with #426.
The fix had this:
re(r"\s+(?:(?:class|def)\s|@)").match(after)
...and I think the comment seems to just confuse the regexp parser.
Black 23.1.0 introduces a new formatting change that requires an empty line before functions: https://github.com/psf/black/pull/3302. In some rare cases, this seems to counteract pydocstyle requirements.
Steps to reproduce
Create the following file:
Run black, see that it inserts a newline before the comment
It's unclear to me whether black or pydocstyle is in the wrong here. Since black is a bigger project, I thought I'd start here and see whether pydocstyle should conform to this new standard set by black or whether this is a bug I should report to black.