yapf
yapf copied to clipboard
How to avoid line break before comparison operator?
Hi, I'm trying to adopt YAPF for a larger code base and am running into a few edge cases. Is there a configuration option to achieve the following desired output? Thanks!
Actual:
long_variable_name = (long_variable_name
== long_variable_name) and (long_variable_name == 1)
Desired:
long_variable_name = (
(long_variable_name == long_variable_name) and (long_variable_name == 1))
# OR
long_variable_name = (
(long_variable_name == long_variable_name) and
(long_variable_name == 1))
# OR at least
long_variable_name = (
long_variable_name == long_variable_name) and (long_variable_name == 1))
pyproject.toml
[tool.yapf]
based_on_style = "pep8"
indent_width = 2
allow_multiline_lambdas = true
continuation_align_style = "FIXED"
continuation_indent_width = 4
dedent_closing_brackets = false
each_dict_entry_on_separate_line = false
spaces_around_power_operator = true
split_arguments_when_comma_terminated = true
split_before_closing_bracket = false
split_before_expression_after_opening_paren = true
split_before_first_argument = true
split_before_logical_operator = false
split_before_named_assigns = false
split_complex_comprehension = true
Maybe what's missing here is something like split_before_first_argument = true but for parens that group code statements rather than just argument lists of function calls?
Hi, I just wanted to raise this issue again. Is there any way to fix this?
@bwendling @Spitfire1900 Is this something you might be able to look into?