docformatter fix does not consider parameters for added newlines

Open
#408 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@AtharvRG is already working on this.

Since Oct 31, 2026.

Assessment

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

Research direction

Reproduce the formatting with the configuration and command linked in setup.cfg and Makefile using docformatter v1.7.8, using the _publish_shapefile_request docstring as the example. Locate the logic that splits the summary and description and then inserts or indents parameter lines. Done means the description is followed by another newline and the :param entries retain their original indentation.

Written by the indexing model from the issue text.

Description

fresh

Given a sentence detected with a ., which gets split into summary/description (as it should), the result doesn't seem to check correctly if the newlines it introduces cause an invalid structure by placing the description right on top of some parameter description.

For some reason, it picks to indent the parameters, which is incorrect.
It should instead add another newline and leave the parameters as they were.

    @geoserver_response_handling
    def _publish_shapefile_request(self,
                                   *,
                                   workspace_name: str,
                                   datastore_name: str,
                                   filename: str,
                                   ) -> requests.Response:
        """
-        Request to publish a shapefile in Geoserver. Does so by creating a `Feature type` in Geoserver.
+        Request to publish a shapefile in Geoserver.
 
-        :param workspace_name: Workspace where file will be published
-        :param datastore_name: Datastore where file will be published
-        :param filename: Name of the shapefile (with no extensions)
-        :returns: Response object
+        Does so by creating a `Feature type` in Geoserver.
+                :param workspace_name: Workspace where file will be published
+                :param datastore_name: Datastore where file will be published
+                :param filename: Name of the shapefile (with no extensions)
+                :returns: Response object
        """
        ...

config: https://github.com/Ouranosinc/cowbird/blob/2c3ee23c703ce18b16017ba77f0e211da91a0b47/setup.cfg#L43-L48

command: https://github.com/Ouranosinc/cowbird/blob/2c3ee23c703ce18b16017ba77f0e211da91a0b47/Makefile#L703-L713

using https://github.com/PyCQA/docformatter/releases/tag/v1.7.8

Dominant language
Python
Stars
600
Forks
107
Avg merge
22h 15m
Merged PRs (30d)
12

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from PyCQA/docformatter

All issues in PyCQA/docformatter

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.