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

Black generates different line breaks for similarly structured codes #1840

Open
inyeollee opened this issue Nov 25, 2020 · 0 comments
Open
Labels
F: linebreak How should we split up lines? T: style What do we want Blackened code to look like?

Comments

@inyeollee
Copy link

inyeollee commented Nov 25, 2020

Black v20.8b1

Black inserts line breaks after parenthesis for 'foo == long_expression_with_parenthesis' as expected, but if I restructure the code as 'long_expression_with_parentheses == foo', then it wraps the whole expression with parenthesis, quite different from the original formatting.

Playground link

Options

--line-length=20
--safe

Input

assert foo == func(loooooooooong_args)
assert func(loooooooooong_args) == foo

Output

assert foo == func(
    loooooooooong_args
)
assert (
    func(
        loooooooooong_args
    )
    == foo
)

Expected

assert foo == func(
  loooooooooong_args
)
assert func(
  loooooooooong_args
) == foo
@ichard26 ichard26 added the T: style What do we want Blackened code to look like? label Apr 2, 2021
@JelleZijlstra JelleZijlstra added the F: linebreak How should we split up lines? label May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: linebreak How should we split up lines? T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

3 participants