Skip to content

Split first and only argument into separate line #1219

Open

Description

How to let yapf to respect the style of splitting the argument in new line instead of the line that opening parenthesis at
here is my original code

def func_name(arg1, arg2):
    if condition:
        log_info.update(
            {
                'A': 1,
                'B': 2,
            },
        )

after yapf

def func_name(arg1, arg2):
    if condition:
        log_info.update({
            'A': 1,
            'B': 2,
        }, )

yapf setting

based_on_style = "pep8"
spaces_before_comment = 2
split_before_logical_operator = true
column_limit = 160
indent_width = 4
DEDENT_CLOSING_BRACKETS = true
BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = true
ALLOW_SPLIT_BEFORE_DICT_VALUE = false
ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS = true
SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED = true
ALLOW_MULTILINE_LAMBDAS = true
SPLIT_PENALTY_IMPORT_NAMES = 1000
BLANK_LINES_BETWEEN_TOP_LEVEL_IMPORTS_AND_VARIABLES = 2
ALLOW_MULTILINE_DICTIONARY_KEYS = true
SPLIT_BEFORE_CLOSING_BRACKET = true
SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN = true
SPLIT_BEFORE_FIRST_ARGUMENT = true
JOIN_MULTIPLE_LINES = false
EACH_DICT_ENTRY_ON_SEPARATE_LINE = true
FORCE_MULTILINE_DICT = true
COALESCE_BRACKETS = false
ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT = true
SPLIT_BEFORE_NAMED_ASSIGNS = false

I have read several issue threads to edit the config of yapf. But no one works...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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