-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Micha Reiser <micha@reiser.io>
- Loading branch information
1 parent
2951339
commit 494e4d2
Showing
12 changed files
with
471 additions
and
150 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
crates/ruff_python_formatter/resources/test/fixtures/ruff/multiline_string_deviations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This file documents the deviations for formatting multiline strings with black. | ||
|
||
# Black hugs the parentheses for `%` usages -> convert to fstring. | ||
# Can get unreadable if the arguments split | ||
# This could be solved by using `best_fitting` to try to format the arguments on a single | ||
# line. Let's consider adding this later. | ||
# ```python | ||
# call( | ||
# 3, | ||
# "dogsay", | ||
# textwrap.dedent( | ||
# """dove | ||
# coo""" % "cowabunga", | ||
# more, | ||
# and_more, | ||
# "aaaaaaa", | ||
# "bbbbbbbbb", | ||
# "cccccccc", | ||
# ), | ||
# ) | ||
# ``` | ||
call(3, "dogsay", textwrap.dedent("""dove | ||
coo""" % "cowabunga")) | ||
|
||
# Black applies the hugging recursively. We don't (consistent with the hugging style). | ||
path.write_text(textwrap.dedent("""\ | ||
A triple-quoted string | ||
actually leveraging the textwrap.dedent functionality | ||
that ends in a trailing newline, | ||
representing e.g. file contents. | ||
""")) | ||
|
||
|
||
|
||
# Black avoids parenthesizing the following lambda. We could potentially support | ||
# this by changing `Lambda::needs_parentheses` to return `BestFit` but it causes | ||
# issues when the lambda has comments. | ||
# Let's keep this as a known deviation for now. | ||
generated_readme = lambda project_name: """ | ||
{} | ||
<Add content here!> | ||
""".strip().format(project_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.