ruff/crates/ruff_python_formatter/src
Charlie Marsh d7508af48d
Truncate to one empty line in stub files (#7558)
## Summary

This PR modifies a variety of sites in which we insert up to two empty
lines to instead truncate to at most one empty line in stub files. We
already enforce this in _some_ places, but not all.

## Test Plan

`cargo test`

No changes in similarity (as expected, since this only impacts
unformatted `.pyi` files).

Before:

| project | similarity index | total files | changed files |

|--------------|------------------:|------------------:|------------------:|
| cpython | 0.76083 | 1789 | 1631 |
| django | 0.99983 | 2760 | 36 |
| transformers | 0.99963 | 2587 | 323 |
| twine | 1.00000 | 33 | 0 |
| typeshed | 0.99979 | 3496 | 22 |
| warehouse | 0.99967 | 648 | 15 |
| zulip | 0.99972 | 1437 | 21 |

After:

| project | similarity index | total files | changed files |

|--------------|------------------:|------------------:|------------------:|
| cpython | 0.76083 | 1789 | 1631 |
| django | 0.99983 | 2760 | 36 |
| transformers | 0.99963 | 2587 | 323 |
| twine | 1.00000 | 33 | 0 |
| typeshed | 0.99979 | 3496 | 22 |
| warehouse | 0.99967 | 648 | 15 |
| zulip | 0.99972 | 1437 | 21 |
2023-09-21 16:24:42 -04:00
..
comments Truncate to one empty line in stub files (#7558) 2023-09-21 16:24:42 -04:00
expression Allow parenthesized content exceed configured line width (#7490) 2023-09-20 08:39:25 +02:00
module Fix handling of newlines in empty files (#7473) 2023-09-18 06:08:10 +00:00
other Avoiding grouping comprehension targets separately from conditions (#7429) 2023-09-16 17:19:34 +00:00
pattern Use CommentRanges in backwards lexing (#7360) 2023-09-16 03:21:45 +00:00
snapshots Remove exception-handler lexing from unused-bound-exception fix (#5851) 2023-07-18 18:27:46 +00:00
statement Truncate to one empty line in stub files (#7558) 2023-09-21 16:24:42 -04:00
type_param Introduce Token element (#7048) 2023-09-02 10:05:47 +02:00
builders.rs Introduce Token element (#7048) 2023-09-02 10:05:47 +02:00
cli.rs Show header for formatter comment decoration info (#7228) 2023-09-08 09:25:06 +00:00
context.rs Implement DerefMut for WithNodeLevel (#6443) 2023-08-11 10:41:48 +00:00
generated.rs Introduce AST nodes for PatternMatchClass arguments (#6881) 2023-08-26 14:45:44 +00:00
lib.rs Introduce FormatterSettings (#7545) 2023-09-21 08:01:24 +02:00
main.rs Formatter: Add SourceType to context to enable special formatting for stub files (#6331) 2023-08-04 11:52:26 +00:00
options.rs Introduce FormatterSettings (#7545) 2023-09-21 08:01:24 +02:00
prelude.rs Accept any Into<AnyNodeRef> as Comments arguments (#5205) 2023-06-20 16:49:21 +00:00
settings.rs Introduce FormatterSettings (#7545) 2023-09-21 08:01:24 +02:00
verbatim.rs Memoize text width (#6552) 2023-09-06 07:10:13 +00:00