ruff/crates/ruff_python_formatter/src
Charlie Marsh 615337a54d
Remove newline-insertion logic from JoinNodesBuilder (#6205)
## Summary

This PR moves the "insert empty lines" behavior out of
`JoinNodesBuilder` and into the `Suite` formatter. I find it a little
confusing that the logic is split between those two formatters right
now, and since this is _only_ used in that one place, IMO it is a bit
simpler to just inline it and use a single approach to tracking state
(right now, both are stateful).

The only other place this was used was for decorators. As a side effect,
we now remove blank lines in both of these cases, which is a known but
intentional deviation from Black (which preserves the empty line before
the comment in the first case):

```python
@foo

# Hello
@bar
def baz():
    pass

@foo

@bar
def baz():
    pass
```
2023-07-31 16:58:15 -04:00
..
comments Ignore end-of-line file exemption comments (#6160) 2023-07-29 00:40:32 +00:00
expression Fix formatting of trailing unescaped quotes in raw triple quoted strings (#6202) 2023-07-31 19:25:16 +02:00
module Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
other Unbreak main (#6123) 2023-07-27 10:22:13 -04:00
pattern Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
snapshots Remove exception-handler lexing from unused-bound-exception fix (#5851) 2023-07-18 18:27:46 +00:00
statement Remove newline-insertion logic from JoinNodesBuilder (#6205) 2023-07-31 16:58:15 -04:00
builders.rs Remove newline-insertion logic from JoinNodesBuilder (#6205) 2023-07-31 16:58:15 -04:00
cli.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
context.rs Remove parser dependency from ruff-python-ast (#6096) 2023-07-26 17:47:22 +02:00
generated.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
lib.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
main.rs
options.rs Prefer the configured quote style 2023-06-26 14:24:25 +02:00
prelude.rs Accept any Into<AnyNodeRef> as Comments arguments (#5205) 2023-06-20 16:49:21 +00:00