PyCQA / PyCQA/docformatter

docformatter removes blank line after last section in docstrings

Open
#43 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C: style P: enhancement U: low
Dominant language
Python
Stars
598
Forks
93
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the SomeClass docstring example and inspect how docformatter handles the final section blank line; compare the result with pydocstyle's D413 expectation. Done means docformatter preserves the blank line after the last section while retaining existing formatting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.