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 reformats conditionals to be too long #815

Closed
rouge8 opened this issue Apr 24, 2019 · 2 comments
Closed

black reformats conditionals to be too long #815

rouge8 opened this issue Apr 24, 2019 · 2 comments
Labels
T: bug Something isn't working

Comments

@rouge8
Copy link
Contributor

rouge8 commented Apr 24, 2019

Black sometimes reformats conditionals (and possibly other code) to exceed the 88 character line length.

Given code like this:

def f():
    def g():
        def h():
            if (
                expected_sig != sig.strip()
                and expected_sig != six.moves.urllib.parse.unquote_plus(sig.strip())
            ):
                something()

Black reformats it to:

def f():
    def g():
        def h():
            if expected_sig != sig.strip() and expected_sig != six.moves.urllib.parse.unquote_plus(
                sig.strip()
            ):
                something()

which is longer than 88 characters.

Operating system: OS X
Python version: 3.7.3
Black version: d6db1c1
Does also happen on master: yes

@Aareon
Copy link

Aareon commented Apr 26, 2019

I believe black should probably (assuming its not doing so already) perform a check whether conditional subsections (parts between and/or) can/should be split between lines depending on how long each section will make a specific line.

@ichard26
Copy link
Collaborator

Closing as this bug doesn't exist after commit 586d242. Thanks for reporting the bug though!

@ichard26 ichard26 added T: bug Something isn't working and removed T: style What do we want Blackened code to look like? labels Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants