Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Version control. Auto-formatting means you'll never, ever, have to deal with diffs where 50% of the changes are indentation, commas and line breaks.

There is still room for 'style' in how you write code, what the code does is what matters. Formatting simply removes noise.



It depends on the formatter you're using. If it's strict about line width you'll end up with a lot of noise in the diffs. Prettier will re-format single-line lists that goes one character over the threshold and then re-condense them once it's able to fit under that threshold. It's not uncommon for a change that adds three classes to three different elements to become a 20 line diff.


Excellent.

Otherwise people sharing that criteria will never fix minor code style issues because "it was that way before, and it's such a minor thing, and it makes my merge harder, please accept the review and ship it don't be unreasonable", and of course we are "reasonable" and end up with thousands of "minor things" over time and the more there are the more people feel it's fine to leave shit in, the less comfortable they feel with the code until eventually they all quit and leave the mess to someone else.

I don't even want to imagine how bad the shitshow is going to get as AI coding assistants gain marketshare.

gofmt's normalization of code formatters was the single greatest achievement Go has to its name, and Prettier was a clear improvement on it. If fixing this crap is bothering anyone's laziness or their artistic sentimentalities then they better get to solving the issue where we're still storing code in source control instead of ASTs and letting the editors render them however the user wants.


I agree with this 100%. I would extend it by saying that one you make formatting mandatory, the rules themselves don't matter, as long as they are the same for everyone on the project.

One could also make formatting automatic through git hooks and then every one can override their local formatting rules to their liking without breaking the common rules.

Eventually you realize that what's really needed is AST-based semantic revision control. Text is a lowest common denominator that all programming tools should go beyond, not just the compilers.


Nah, you still get those diffs when the autoformat rules change


Good thing Go and gofmt are very stable and consider compatibility a significant feature.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: