Skip to content

Keep the blank lines the author wrote unless asked to remove them - #375

Merged
Mpdreamz merged 1 commit into
mainfrom
fix/blank-line-defaults
Nov 16, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
fix/blank-line-defaults

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

With no blank-line keys set, Curb collapsed runs of blank lines and removed the ones inside braces and at the start of a file, which dotnet format whitespace leaves alone (#368).

What

  • csharp_keep_blank_lines_in_declarations and csharp_keep_blank_lines_in_code default to unlimited (were 1).
  • csharp_remove_blank_lines_near_braces_in_declarations and _in_code default to false (were true).
  • With those off, the blank lines above a type's or block's closing brace and at the start of a file are kept too (they were dropped even with the keys relaxed). No minimum is forced above a block's first statement, so csharp_blank_lines_around_local_method does not add a blank line under an opening brace.
  • The old behaviour is keep = 1 and remove_near_braces = true; the tests of it set both through LegacyBlankLines. Several *_by_default tests are renamed *_when_asked.

Behaviour change: output for repositories with no blank-line keys moves (blank lines now stay). Breaking for 0.x, so the next release is 0.16.0.

Verify

  • Full suite passes (2284); new test Every_blank_line_the_author_wrote_is_kept_by_default is Default blank-line settings remove blank lines dotnet format keeps #368's input, unchanged.
  • ./build.sh verifyexpectations passes; curb check src tools tests reports nothing to change; ./build.sh options regenerated the docs.
  • Corpus conformance with dotnet format whitespace: 98.72% (2089/2116), above the ~90% floor.

Closes #368

🤖 Generated with Claude Code

dotnet format removes and collapses no blank line. Curb capped runs at one and stripped
blank lines inside braces and at the start of a file. The defaults of
csharp_keep_blank_lines_in_declarations/_in_code are now unlimited, and
csharp_remove_blank_lines_near_braces_in_declarations/_in_code are false, so the blank lines
above a closing brace and at the start of a file stay too. The previous behaviour is one
editorconfig away.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz Mpdreamz added the breaking Breaks a public API or behaviour (0.x: minor bump, 1.x+: major) label Nov 16, 2026
@Mpdreamz
Mpdreamz merged commit dee87b7 into main Nov 16, 2026
10 checks passed
@Mpdreamz
Mpdreamz deleted the fix/blank-line-defaults branch November 16, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaks a public API or behaviour (0.x: minor bump, 1.x+: major)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default blank-line settings remove blank lines dotnet format keeps

1 participant