Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Multi-line summary has closing quotes on the same line #84

Closed
howeaj opened this issue May 5, 2022 · 1 comment
Closed

Bug: Multi-line summary has closing quotes on the same line #84

howeaj opened this issue May 5, 2022 · 1 comment
Labels
C: convention Relates to docstring format convention P: enhancement Feature that is outside the scope of PEP 257 S: duplicate Closed as a duplicate issue or PR

Comments

@howeaj
Copy link
Contributor

howeaj commented May 5, 2022

Docformatter's readme states that it follows the following PEP 257 item:

Unless the entire docstring fits on a line, place the closing quotes on a line by themselves.

But it doesn't; it only places the closing quotes on a line by themselves if there is a description (or if the option --make-summary-multi-line is specified, but then it puts the opening quotes on a separate line too)

i.e. with default arguments it formats this:

"""Loooooooooooooooooooooooooooooooooong summary line that will get wrapped to multiple lines."""

to this:

"""Loooooooooooooooooooooooooooooooooong summary line that will get
wrapped to multiple lines."""

when it should instead format to this:

"""Loooooooooooooooooooooooooooooooooong summary line that will get
wrapped to multiple lines.
"""
@weibullguy weibullguy added P: enhancement Feature that is outside the scope of PEP 257 S: duplicate Closed as a duplicate issue or PR and removed P: enhancement Feature that is outside the scope of PEP 257 labels Jul 24, 2022
@weibullguy
Copy link
Member

Per PEP-257, one-line docstrings should fit on a single line including the triple quotes. Placing the closing triple quotes on a new line is for multi-line docstrings. It seems the PEP-257 preferred solution would be to shorten the docstring to fit on a single line.

The --wrap-summaries argument can be used to set the point at which docformatter breaks the line if there's a need to accommodate lines longer than 79 characters. However, placing the closing triple quotes in-line with a one-line docstring, even a really long one, is in accordance with PEP-257. Thus, this behavior is not a bug.

This issue is a duplicate to #9 which is to be addressed by #49. Closing to #9.

@weibullguy weibullguy added P: enhancement Feature that is outside the scope of PEP 257 C: convention Relates to docstring format convention labels Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: convention Relates to docstring format convention P: enhancement Feature that is outside the scope of PEP 257 S: duplicate Closed as a duplicate issue or PR
Projects
None yet
Development

No branches or pull requests

2 participants