PyCQA / docformatter

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

Do not remove linebreak after opening quotes if there's no single-line heading #240

Closed ThiefMaster closed 1 year ago

ThiefMaster commented 1 year ago

For example, I would not expect this change to happen:

 def _get_persons(event, condition):
-    """
-    Query event persons linked to contributions in the event,
-    filtered using the condition provided.
-    """
+    """Query event persons linked to contributions in the event, filtered using
+    the condition provided."""

This function has just a piece of text in the docstring and not the typical "One-line header, longer body" format.

PEP-257 has no opinion on this, but it feels cleaner to never have a "wrapped" line starting in the line of the """.

weibullguy commented 1 year ago

With the --make-summary-multi-line argument, you get the following diff, which is what I think you're looking for.

 def _get_persons(event, condition):
     """
-    Query event persons linked to contributions in the event,
-    filtered using the condition provided.
+    Query event persons linked to contributions in the event, filtered using the
+    condition provided.
     """

docformatter --help or the docs can be helpful.