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

Formatter: Multiline string followed by call expression #6938

Closed
MichaReiser opened this issue Aug 28, 2023 · 0 comments
Closed

Formatter: Multiline string followed by call expression #6938

MichaReiser opened this issue Aug 28, 2023 · 0 comments
Labels
formatter Related to the formatter

Comments

@MichaReiser
Copy link
Member

I create this issue to document our decision on call expression formatting that directly follows a multiline string.

This is how stable black formats a multiline string

sql = """
INSERT INTO {0}_pony (pink, weight) VALUES (1, 3.55);
INSERT INTO {0}_pony (pink, weight) VALUES (3, 5.0);
""".format(
    app_label
)

But Ruff collapses the format call if it fits on the line

sql = """
INSERT INTO {0}_pony (pink, weight) VALUES (1, 3.55);
INSERT INTO {0}_pony (pink, weight) VALUES (3, 5.0);
""".format(app_label)

Ruff's formatting matches Black's preview improve multiline string handling formatting.

Ruff will only support the preview formatting because implementing the non-preview style requires specialised formatting that doesn't seem justified considering that this style will change soon anyway (and seems better IMO).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter
Projects
None yet
Development

No branches or pull requests

1 participant