Skip to content

Adjacent compound statements with fmt: skip add extraneous empty lines #22406

@dylwil3

Description

@dylwil3

Summary

This:

def a(): foo() # fmt: skip
def a(): foo() # fmt: skip

gets formatted to:

def a(): foo()  # fmt: skip


def a(): foo()  # fmt: skip

which looks a bit silly. This also deviates from Black's formatting.

I suppose an argument could be made that this is not a bug and we have to use fmt: on/off here since the rules for empty lines are coming from general rules about formatting function definitions in suites? But it feels like the output is unexpected for a generic user - it was certainly unexpected to me.

Playground link

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    formatterRelated to the formatterstyleHow should formatted code look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions