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

[Feature request] multi-line method invocation style / multiline unhug parens (like add-trailing-comma) #3713

Open
Avasam opened this issue Mar 24, 2023 · 1 comment
Labels
rule Implementing or modifying a lint rule

Comments

@Avasam
Copy link

Avasam commented Mar 24, 2023

#1058 (comment)

add-trailing-commas also has unhug-trailing-paren, unhug-leading-paren and avoids arbitrary indentation. Which is not enforced by Ruff or Autopep8. Even Black only enforces it when magic commas are used:

# This is found acceptable by Ruff, Autopep8 and Black
print(1,
      2,
      3,
      4,
      5)
      
# This is what add-trailing-commas changes it to
print(
    1,
    2,
    3,
    4,
    5,
)

So Ruff hasn't yet completely replaced it for me, though I'd love to see it get there. Is this the right place or should I open a new issue?

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Mar 24, 2023
@Avasam
Copy link
Author

Avasam commented Oct 28, 2023

Update:
Both Black and Ruff now formats:

#from 
print(1,
      "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
      2,
      3,
      4,
      5)
      
# to
print(
    1,
    "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
    2,
    3,
    4,
    5,
)

###

# from 
print(1,
      2,
      3,
      4,
      5)
      
# to
print(1, 2, 3, 4, 5)

I would still like it as a fixable styling lint rule, as Ruff format still has some of the things I dislike about Black and prefer autopep8 for.

I also think that just like #8279, the following should not be flagged (or split-off) as an improvement over add-trailing-comma:

# This is better
print([
    1,
    2,
    3,
    4,
    5,
])

# but add-trailing-comma does:
print(
  [
      1,
      2,
      3,
      4,
      5,
  ],
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

No branches or pull requests

2 participants