PyCQA / PyCQA/docformatter

The docformatter adds blank line between ocstring and async with block (conflicts with Ruff (pydocsyle))

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

Nobody has claimed this yet.

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

Description

When we use async with block, docformatter adds blank line between ocstring and async with block.

How to reproduce

Crate test.py:

"""Example."""

import asyncio

lock = asyncio.Lock()


async def example() -> None:
    """Example."""
    async with lock:
        pass

And run docformatter:

$ docformatter --diff example.py 
--- before/example.py
+++ after/example.py
@@ -7,5 +7,6 @@
 
 async def example() -> None:
     """Example."""
+
     async with lock:
         pass

After formatting by docstring, Ruff (and pydocstyle) fixes it to no lines.

blank-line-after-function (D202) | Ruff

I tested docformatter v1.7.8

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 test.py or example.py input and run docformatter --diff, then compare the result with Ruff or pydocstyle. Trace the formatter’s handling of an async with block after a function docstring; done means docformatter no longer inserts the conflicting blank line.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.