logoalt Hacker News

throwaway219450 • yesterday at 11:55 PM • 0 replies • view on HN

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.