-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
formatterRelated to the formatterRelated to the formatterstyleHow should formatted code lookHow should formatted code look
Description
Summary
Ref: #8566, #9745 (comment), #9745 (comment), #9745 (comment), #9745 (comment).
Description
Black's 2022 style removes empty newlines after code block open. However, as of the 2024 style, it now allows one empty first line at the beginning of most blocks (psf/black#3967).
For class headers, Ruff still follows the 2022 style, producing the following result:
Input file
class Migration(migrations.Migration):
dependencies = []black
class Migration(migrations.Migration):
dependencies = []ruff
class Migration(migrations.Migration):
dependencies = []Use case
For us, this is a blocker when migrating from black to ruff for formatting Django migrations, as it would produce noisy diffs that are otherwise avoidable.
As of #21110 (v0.14.4), one empty newline is now allowed after function headers. I'd like to make a case for class headers as well.
Thanks for all the great work!
Version
0.14.4
the21st
Metadata
Metadata
Assignees
Labels
formatterRelated to the formatterRelated to the formatterstyleHow should formatted code lookHow should formatted code look