Skip to content

Allow newlines after block open (or not) #9745

@vaughnkoch

Description

@vaughnkoch

Hi, I'm opening this issue per a suggestion from @MichaReiser, based on this closed issue: #8893.

The formatting question is whether Ruff should automatically remove a blank line after a block definition:

def some_func():

    some_more_code()

to

def some_func():
    some_more_code()

The alternative is "allow zero or one" newlines, i.e. not to remove the newline if it exists, but also not to automatically add one. This is the approach that Black chose in their 2024 preview style. Full Black discussion here: psf/black#4043.

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