PyCQA / PyCQA/docformatter

Docstrings containing backticks are not formatted

Open
#272 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I posted a comment in #243 but am not sure that will be seen since that issue is closed. I have

% docformatter --version
docformatter 1.7.5

and the fix from that issue appears to apply only to the first line and not to the description lines that follow, e.g.

% cat foo.py
def f():
    """
    Here is a sufficiently long docstring first line with a ``word`` wrapped in backticks which will be wrapped as expected.

    Here is a sufficiently long docstring description with a ``word`` wrapped in backticks which will not be wrapped as expected.
    """
    pass
% docformatter foo.py
% cat foo.py
def f():
    """
    Here is a sufficiently long docstring first line with a ``word`` wrapped in backticks which will
    be wrapped as expected.

    Here is a sufficiently long docstring description with a ``word`` wrapped in backticks which will not be wrapped as expected.
    """
    pass

Is this intended / am I doing it wrong?

Here's my config block in pyproject.toml:

[tool.docformatter]
black = true
in-place = true
make-summary-multi-line = true
pre-summary-newline = true
recursive = true
wrap-descriptions = 100
wrap-summaries = 100

Thanks in advance for any guidance, and thanks in general for this great tool!

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 report with the shown foo.py and pyproject.toml configuration, then run docformatter 1.7.5 or the current version. Trace how description lines containing double backticks are wrapped; done means those lines are formatted consistently with the first docstring line without breaking the backtick markup.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.