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: not splitting two sentence summary into description #275

Closed
jamesbraza opened this issue Jan 31, 2024 · 1 comment
Closed

Bug: not splitting two sentence summary into description #275

jamesbraza opened this issue Jan 31, 2024 · 1 comment
Labels
S: invalid Closed as invalid with respect to docformatter

Comments

@jamesbraza
Copy link

jamesbraza commented Jan 31, 2024

Please see the below Python snippet, I am using Python 3.11 with docformatter==1.7.5:

# a.py

def foo() -> None:
    """I am a first sentence this long. I am another sentence that I would like to be in summary."""

Running docformatter --black --close-quotes-on-newline a.py formats it to:

# a.py

def foo() -> None:
    """
    I am a first sentence this long.

    I am another sentence that I would like to be in summary.
    """

I understand why the summary line is being split, because it violates the 88-char summary wrap length. However, I would like docformatter to avoid splitting the summary into a description like so:

# a.py

def foo() -> None:
    """
    I am a first sentence this long. I am another sentence that I would like to be in
    summary.
    """

I think what this warrants is:

  • New arg --no-split-summary-description or --no-split-first-sentence
  • Or a new regex to split the first sentence with, which can be set to \n
@github-actions github-actions bot added the fresh This is a new issue label Jan 31, 2024
@weibullguy
Copy link
Member

Per PEP-257:

Multi-line docstrings consist of a summary line just like a one-line docstring, followed by a blank line, followed by a more elaborate description.

And and one-line docstring, per PEP-257:

The docstring is a phrase ending in a period. It prescribes the function or method’s effect as a command (“Do this”, “Return that”), not as a description; e.g. don’t write “Returns the pathname …”.

The example you provide is a multi-line docstring per PEP-257 and is being handled appropriately.

@weibullguy weibullguy added S: invalid Closed as invalid with respect to docformatter and removed fresh This is a new issue labels Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: invalid Closed as invalid with respect to docformatter
Projects
None yet
Development

No branches or pull requests

2 participants