Skip to content

Ruff format always splits single positional-only argument list across two lines #9074

@drhagen

Description

@drhagen

Black keeps this code as is:

def some_function(
    string: str, /
) -> ReallyReallyReallyReallyReallyReallyReallyReallyLongName:
    pass

But Ruff 0.1.7 forces the argument list to be split across lines.

def some_function(
    string: str,
    /,
) -> ReallyReallyReallyReallyReallyReallyReallyReallyLongName:
    pass

I would also consider Black's behavior to be more desirable here. This is a regression from Ruff 0.1.6. I suspect that this was caused by #8921, where it would be easy to think this function has one argument. Semantically, it does, while syntactically, it has two.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingformatterRelated to the formatter

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions