-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
formatterRelated to the formatterRelated to the formatterhelp wantedContributions especially welcomeContributions especially welcomestyleHow should formatted code lookHow should formatted code look
Description
From Black's changelog and Preview
enum. Last checked 19.09.2025, Last release: v25.9.0.
Goals:
- Close parity with Black when migrating from Black to Ruff
- Fix Ruff specific bugs
- Innovate on local formatting (to keep close parity with black)
Preview Styles
Stabilized in Black and not available in Ruff (even in preview)
Black preview styles
-
wrap_long_dict_values_in_parens
Non-goal, see Preview style feedback: Parenthesizing long dict, conditional, and type annotations psf/black#4123 and Nested expression formatting #12856 -
always_one_newline_after_import
This is enforced by unsorted-imports (I001) and configurable vialines-after-imports
. There is already some small conflict with the formatter depending on how the user configures this, and this may cause a little more. Unsure about this one... -
fix_fmt_skip_in_one_liners
Respectfmt: skip
for compound statements on single line #20633 -
wrap_comprehension_in
-
remove_parens_around_except_types
-
normalize_cr_newlines
Already handled by Ruff Ruff 2026 Style Guide #20482 (comment)
Black unstable styles
-
string_processing
Non-goal, various issues https://github.com/psf/black/issues?q=is%3Aissue%20state%3Aopen%20string_processing -
hug_parens_with_braces_and_square_brackets
Note this is already implemented as a Ruff preview feature (see below). So marking this as "done" here, and deferring to the below list for whether to stabilize. See also format: different behavior with black forhug_parens_with_braces_and_square_brackets
and generators #11375 -
multiline_string_handling
According to 2025 issue: "non goal. Maybe a simplified version of it that only joins implicitly concatenated strings"
Ruff preview styles
Ruff specific preview styles that we may want to stabilize
-
hug_parens_with_braces_and_square_brackets
-
no_chaperone_for_escaped_quote_in_triple_quoted_docstring
-
blank_line_before_decorated_class_in_stub
Ruff improvements
Open Bugs
Existing bugs in the ruff formatter for which no preview style exists.
Require a new style guide
Bug fixes that change how existing code is formatted and require a breaking change.
- Unnecessary parantheses to long patterns with
as
captures - Dict key split to multiline (deviation from black)
- Ruff splits subscript targets instead of parenthesizing the value
- Handling of blank lines between module docstring and a comment (unclear if it requires a new style guide) @konstin
- Parenthesize assignment values that fit into the line length
- Handle over-long lambda expressions (possibly requires a new style guide)
Bug fixes that don't change existing formatting
Bug fixes that don't require a new style guide because they don't change existing code
- Range formatting does not handle whitespace before new classes
- Formatter inserts trailing newline at the end of a file even when inside a fmt: off region
- Parenthesized expression with comment on right hand side in assignment produces invalid syntax
- Fuzzer: comment in middle of operand causes panic
- Fuzzer: debug assert on dangling comments failed
- Not respecting
fmt: skip
(possibly related tofix_fmt_skip_in_one_liners
Black preview style) - Preserve trailing whitespace in docstring examples
- Incorrect docstring code block formatting for statement sequences
- Handling of empty lines after
;
- Suppressing statement sequences
- Using
fmt:skip
to suppress compound statements
laymonagevlkorsakov
Metadata
Metadata
Assignees
Labels
formatterRelated to the formatterRelated to the formatterhelp wantedContributions especially welcomeContributions especially welcomestyleHow should formatted code lookHow should formatted code look