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

+ for long line functions with params keep long lines #917

Closed
tbicr opened this issue Jul 3, 2019 · 2 comments
Closed

+ for long line functions with params keep long lines #917

tbicr opened this issue Jul 3, 2019 · 2 comments
Labels
F: linebreak How should we split up lines? F: linetoolong Black makes our lines too long T: bug Something isn't working T: style What do we want Blackened code to look like?

Comments

@tbicr
Copy link

tbicr commented Jul 3, 2019

+ for long line functions with params keep long lines with line-length = 100 parameter:

def xxx(p123456789):
    r123456789 = a123456789012345678901234567890123456789() + b1234567890123456789012345678901234567890123(
        p123456789
    )

expect that next code will not be reformatted:

def xxx(p123456789):
    r123456789 = (
        a123456789012345678901234567890123456789()
        + b1234567890123456789012345678901234567890123(p123456789)
    )

Howdy! Sorry you're having trouble. To expedite your experience,
provide some basics for me:

Operating system: Ubuntu 16.04.6 LTS
Python version: 3.7.3
Black version: 19.3b, master
Does also happen on master: yes

To answer the last question, you have two options:

  1. Use the online formatter at https://black.now.sh/?version=master, which will use the latest master branch.
  2. Or run black on your machine:
    • create a new virtualenv (make sure it's the same Python version);
    • clone this repository;
    • run pip install -e .;
    • make sure it's sane by running python setup.py test; and
    • run black like you did last time.
@JelleZijlstra
Copy link
Collaborator

I had some trouble understanding the complaint but I do think there's a bug here. Given this code:

def xxx(p123456789):
    r123456789 = a123456789012345678901234567890123456789() + b1234567890123456789012345678901234567890123(
        p123456789
    )

Calling Black on it with no arguments produces the second code sample above. But black -l 100 leaves it unchanged, even though the second line exceeds 100 characters.

@ichard26 ichard26 added T: bug Something isn't working T: style What do we want Blackened code to look like? labels May 29, 2021
@JelleZijlstra JelleZijlstra added F: linebreak How should we split up lines? F: linetoolong Black makes our lines too long labels May 30, 2021
@JelleZijlstra
Copy link
Collaborator

My comment above no longer reproduces

% black -l 100 -c '''def xxx(p123456789):
    r123456789 = a123456789012345678901234567890123456789() + b1234567890123456789012345678901234567890123(
        p123456789
    )
'''
def xxx(p123456789):
    r123456789 = (
        a123456789012345678901234567890123456789()
        + b1234567890123456789012345678901234567890123(p123456789)
    )

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? F: linetoolong Black makes our lines too long T: bug Something isn't working T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

3 participants