Skip to content

Add new line after logical operator #844

Open
@Conchylicultor

Description

@Conchylicultor

Currently, I don't think there is a way to have each condition element to have their own line.
Additionally, the current formatting do not respect the split_before_logical_operator.
All condition get clustered like:

if (
    very_long_variable_name is not None and verrry_long_variable_name.field > 0
    or very_long_variable_name.is_debugfs
):
  pass

I would like to format my code as:

if (
    very_long_variable_name is not None
    and verrry_long_variable_name.field > 0
    or very_long_variable_name.is_debugfs
):
  pass

My .config/yapf/style:

[style]
based_on_style = google
indent_width = 2
coalesce_brackets = True
dedent_closing_brackets = True
split_before_dot = True
split_before_logical_operator = True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions