Skip to content

Formatter: Don't insert a newline between if and parentheses in list comprehensions #5672

@konstin

Description

@konstin

We format this black formatted code from django django/apps/config.py

configs = [
    (name, candidate)
    for name, candidate in members
    if (
        issubclass(candidate, cls)
        and candidate is not cls
        and getattr(candidate, "default", True)
    )
]

as

configs = [
    (name, candidate)
    for name, candidate in members
    if
    (
        issubclass(candidate, cls)
        and candidate is not cls
        and getattr(candidate, "default", True)
    )
]

We should change our formatting to also not emit the newline before the parentheses.

Metadata

Metadata

Assignees

Labels

formatterRelated to the formatter

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions