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 doesn't wrap functions with parameter comments #3113

Open
liam-mipac opened this issue Jun 8, 2022 · 0 comments
Open

Black doesn't wrap functions with parameter comments #3113

liam-mipac opened this issue Jun 8, 2022 · 0 comments
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. F: linebreak How should we split up lines? T: bug Something isn't working

Comments

@liam-mipac
Copy link

Describe the bug

If a line that exceeds the character limit has parameter comments, the function won't be moved to a new line inside parentheses.
Without parameter comments, Black will move the function inside parentheses.
Black should be consistent with these cases.

To Reproduce

For example, take this code:

long_variable_name = long_function_name(
    arg1,
    # comment
    arg2,
)

long_variable_name = (
    long_function_name(
        arg1,
        arg2,
    )
)

And run it with these arguments:

$ black file.py --line-length 30

Nothing is changed.

Expected behavior

The first function should be placed within parentheses.

long_variable_name = (
    long_function_name(
        arg1,
        # comment
        arg2,
    )
)

Environment

  • Black's version: 22.3.0
  • OS and Python version: Windows / Python3.10.4

Also tested on https://black.vercel.app/ on main@f51e53

Additional context

Code snippet on https://black.vercel.app/

@liam-mipac liam-mipac added the T: bug Something isn't working label Jun 8, 2022
@ichard26 ichard26 added F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. F: linebreak How should we split up lines? labels Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. F: linebreak How should we split up lines? T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants