Automatic Code Formatters
Comments debate the benefits of auto-formatters like gofmt, Prettier, and Black for enforcing consistent code styles, reducing formatting disputes, and improving team collaboration via standards and CI integration.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Arguably opinionated formatters like prettier and black are a response to gofmt.
Gofmt, or rustfmt or whatever language fmt are really one of the best things that happened to modern development. Even if you don't agree with the style, which nobody does fully, it's much better than having discussions about style all the time and having to format the code manually. Formatting just happens when you save the file, so you can forget spaces and everything when writing and your code will look fine when you save it.
You misunderstand the point of formatters. They aren’t meant to automate your personal preference; they automate a standard format so your team doesn’t have to waste time deciding on and enforcing a coding standard and so you don’t have to manually implement the standard. Implicit in using a code formatter is the decision to stop navel gazing and put the team first.
god save us all from people's style guides. Use your IDE's reformatting tools and go in peace.
You sound like one of those people who format code by hand instead of an in-IDE autoformatter.
It’s very simple: format code to a standard. Preferably the language default formatting. But it must be a standard that can be auto formatted to with a tool. Now when someone doesn’t like that standard, they can auto format from that standard to one of their liking for local development and back again to the project standard for pushing to the project. This can even be done automatically with gitattributes during checkout and commit. But without strictly enforcing a autoformatable standard this
I like to think it's OK because gofmt reduces formatting churn overall.
Would you say that someones code formatting is a shibboleth? How do you feel about formatters and linters in regards to this?
I honestly don't understand how people are still bickering over style guides in modern programming. Autoformatters exist in every major language. Git hooks exist. Company style guides exist. Pick one, and then it's never an issue what editor people are using, it's bizarre that this bikeshed still exists.
Sorry, but formatting is on you. If you don't like the comments, don't commit inconsistent code. Set up a local auto-formatter with the right rules. If enough of the existing code you're working on doesn't conform, set the formatter to only run manually and get in the habit of running it before committing.