PyCQA / PyCQA/docformatter

docformatter seems to have trouble with linebreaks inside directives in info fields

Open
#279 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Saw this issue in PyGithub docstrings, when I fix it docformatter complains about exactly what I'm fixing:

diff --git a/github/Repository.py b/github/Repository.py
index f274973..52bcc11 100644
--- a/github/Repository.py
+++ b/github/Repository.py
@@ -2388,7 +2388,7 @@ class Repository(CompletableGithubObject):
         Create a file in this repository.
 
         :calls: `PUT /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#create-or-
-            update-file-contents>`_
+        update-file-contents>`_
         :param path: string, (required), path of the file in the repository
         :param message: string, (required), commit message
         :param content: string, (required), the actual data in the file
@@ -2470,7 +2470,7 @@ class Repository(CompletableGithubObject):
         This method updates a file in a repository.
 
         :calls: `PUT /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#create-or-
-            update-file-contents>`_
+        update-file-contents>`_
         :param path: string, Required. The content path.
         :param message: string, Required. The commit message.
         :param content: string, Required. The updated file content, either base64 encoded, or 

Trying to remove the linebreak instead of indenting it also makes docformatter amgy:

diff --git a/github/Repository.py b/github/Repository.py
index d7e3c19..52bcc11 100644
--- a/github/Repository.py
+++ b/github/Repository.py
@@ -2387,7 +2387,8 @@ class Repository(CompletableGithubObject):
         """
         Create a file in this repository.
 
-        :calls: `PUT /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#create-or-update-file-contents>`_
+        :calls: `PUT /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#create-or-
+        update-file-contents>`_
         :param path: string, (required), path of the file in the repository
         :param message: string, (required), commit message
         :param content: string, (required), the actual data in the file
@@ -2468,7 +2469,8 @@ class Repository(CompletableGithubObject):
         """
         This method updates a file in a repository.
 
-        :calls: `PUT /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#create-or-update-file-contents>`_
+        :calls: `PUT /repos/{owner}/{repo}/contents/{path} <https://docs.github.com/en/rest/reference/repos#create-or-
+        update-file-contents>`_
         :param path: string, Required. The content path.
         :param message: string, Required. The commit message.
         :param content: string, Required. The updated file content, either base64 encoded, or ready to be encoded.

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 directive linebreak cases shown in the issue, using the linked PyGithub docstring examples and CI results as references. Trace how docformatter handles reStructuredText directives in info fields, then add regression coverage for the intended linebreak and indentation behavior; done means valid forms are formatted without the reported complaint.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.