PyCQA / docformatter

Formats docstrings to follow PEP 257
https://pypi.python.org/pypi/docformatter
MIT License
526 stars 61 forks source link

Blank line removal incompatible with black #176

Closed AntoineD closed 1 year ago

AntoineD commented 1 year ago

If a class docstring contains a line that is too long and cannot be reformatted, passing flake8 can be done by appending a #noqa to the docstring. The following was not modified withdocformatter 1.5.1 and black when triggered by pre-commit:

class C:
    """Class.""" #noqa

    attr: int
    """Attr."""

With docformatter 1.6.1, this is changed to:

class C:
    """Class.""" #noqa
    attr: int
    """Attr."""

and pre-commit always fails because docformatter and black both apply opposite changes.

This behavior is triggered by the comment appended to the docstring.

AntoineD commented 1 year ago

Thank you very much! When do you plan to release it?

weibullguy commented 1 year ago

Well, if I hadn't forgotten to git pull on the master branch after merging the PR that fixed this problem, it would've been part of v1.6.1! 🤦🏻‍♂️ I just released v1.6.2 with this fix.