Comment by ttul
7 hours ago
I've noticed the line breaks issue. It's easily fixed with a formatter like prettier and, frankly, that kind of quality-of-life thing is best handled deterministically anyway.
7 hours ago
I've noticed the line breaks issue. It's easily fixed with a formatter like prettier and, frankly, that kind of quality-of-life thing is best handled deterministically anyway.
I haven't used prettier much but this is what the prettier docs say about empty lines.
> It turns out that empty lines are very hard to automatically generate. The approach that Prettier takes is to preserve empty lines the way they were in the original source code. There are two additional rules: > > - Prettier collapses multiple blank lines into a single blank line. > - Empty lines at the start and end of blocks (and whole files) are removed. (Files always end with a single newline, though.)
The last time I used astra it wrote a lot of rust code where it would insert almost no empty lines at all. Not before functions, structs, impl blocks, etc., and not inside functions to group statements. Similar to prettier, rustfmt doesn't really insert empty lines.
Edit: hmm maybe I misunderstood your and the parent's comment. Are you talking about missing regular newlines after statements, i.e. multiple statements on one line?
I was talking about a function with 100 lines and no line breaks. Very difficult to read.
I use black/ruff on a lot of projects and it will only touch standard-y things like docstring spacing, or spacing between methods and classes, import sorting etc. It doesn’t touch intentional/aesthetic user spacing. With agents it is helpful to make them run ruff and mypy to keep them honest, but as long as the code adheres to the spec, it doesn’t get changed. Astra also creates things like “report” functions with 10 arguments, so it’s useful to turn on complexity checkers as well.
I don’t see how Prettier is any better here unless you really want everything to be deterministic; how could it possibly know (always) when to insert a line? Aside from some more obvious cases like adding a gap before a loop declaration. Sometimes I group lines because they’re part of a mathematical formula or other operation and it makes sense to me, but Prettier doesn’t know that.
Doesn’t this mess up the context though? I use ruff and my agents get confused if I edit and run ruff out of band. How do people deal with that? I’m always having to remind agents to re-read files because they’ve changed
I find it is okay if I tell the agent that running the formatting step is required before every commit.