Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split first and only argument into separate line #1219

Open
SachiaLanlus opened this issue Apr 3, 2024 · 0 comments
Open

Split first and only argument into separate line #1219

SachiaLanlus opened this issue Apr 3, 2024 · 0 comments

Comments

@SachiaLanlus
Copy link

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant