Skip to content

The docformatter removes blank line against PEP8 (conflicts with Ruff (Black)) #350

@yukihiko-shinoda

Description

@yukihiko-shinoda

When the import blocks don't exist, docformatter formats 2 blank lines to 1.

How to reproduce

Crate test.py:

"""Module docstring."""


class Foo:
    """Foo class."""

And run docformatter:

$ docformatter --diff test.py
--- before/test.py
+++ after/test.py
@@ -1,5 +1,4 @@
 """Module docstring."""
-
 
 class Foo:
     """Foo class."""

After formatting by docstring, Ruff (and Black) fixes it to 2 lines.

PEP 8 – Style Guide for Python Code | peps.python.org

Surround top-level function and class definitions with two blank lines.

I tested docformatter v1.7.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    freshThis is a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions