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

docformatter removes blank line after last section in docstrings #43

Open
Andrew-Sheridan opened this issue Nov 24, 2019 · 2 comments
Open
Labels
C: style Relates to docstring format style (e.g., Google, NumPy, Sphinx) P: enhancement Feature that is outside the scope of PEP 257 U: low A relatively low urgency issue
Milestone

Comments

@Andrew-Sheridan
Copy link

Andrew-Sheridan commented Nov 24, 2019

Issue Summary

If a docstring has a summary and a description that consists of at least one section, then there should be a blank line between the last line of the section and the the final """ of the docstring.

Example

Given the class SomeClass below, docformatter will remove the blank line at the end of the class dosctring, after the "Methods" section. In contrast, pydocstyle will throw a D413 error if that blank line is removed: D413: Missing blank line after last section ('Methods').

Is it possible to setup docformatter to respect D413?

class SomeClass:
    """Summary.

    Methods:
        method_1
        method_2
        method_3

    """

    def __init__(self):
        """Summary.

        Details about this thing that does nothing.
        """
        pass
@weibullguy
Copy link
Member

The blank line after the last section is a numpy (and Google?) docstring convention. pydocstyle should only raise the D413 if it is passed the --convention=numpy or --convention=google argument. At the moment, no, docformatter can't be configured to respect the numpy or google convention. However, see #60.

@weibullguy weibullguy added C: style Relates to docstring format style (e.g., Google, NumPy, Sphinx) and removed help wanted labels Aug 7, 2022
@weibullguy weibullguy added this to the v2.0.0 milestone Aug 21, 2022
@weibullguy weibullguy modified the milestones: v2.0.0, v1.8.0 May 15, 2023
@electric-coder
Copy link

electric-coder commented Jun 1, 2023

@weibullguy I think this issue can be closed. Using the --blank = false option from the Current Implementation in version 1.7.1 does currently remove the empty blank line from the end of the docstring. Conversly using --blank = true adds the blank line.

@weibullguy weibullguy added P: enhancement Feature that is outside the scope of PEP 257 and removed P: enhancement Feature that is outside the scope of PEP 257 labels Jun 7, 2023
@github-actions github-actions bot added the U: low A relatively low urgency issue label Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: style Relates to docstring format style (e.g., Google, NumPy, Sphinx) P: enhancement Feature that is outside the scope of PEP 257 U: low A relatively low urgency issue
Projects
None yet
Development

No branches or pull requests

4 participants