News for hackers. Stuff that matters.
Re:Formatting code should be unnecessary by wartijn_ on Monday September 08, 2025 @02:09AM (#45165095)
Which defaults? The programming languages I’ve worked with don’t have defaults for everything related to formatting. Editor defaults don’t work, since not everybody uses the same editor. So you have to make a choice somewhere.
Re:Formatting code should be unnecessary by swiftcoder on Monday September 08, 2025 @02:31AM (#45165208)
A lot of (relatively) recent languages do have defaults. Go and rust both come with an auto formatter out of the box, and defaults that are sane enough to just run with
Re:Formatting code should be unnecessary by wartijn_ on Monday September 08, 2025 @05:02AM (#45166092)
Ah yeah, in those cases it is possible to just use the defaults. Come to think of it, I have worked with Deno, which comes with a formatter (and linter and testing library) and I’m a fan. Saves a couple of dependencies, some config files and a bit of mental overhead when creating a new project.
Re:Formatting code should be unnecessary by stavros on Monday September 08, 2025 @02:54AM (#45165335)
I guess the GP means "use an opinionated formatter", I agree with both of you.
Re:Formatting code should be unnecessary by genericspammer on Monday September 08, 2025 @06:12AM (#45166493)
Please inform me what the defaults are for Java, C#, C++, C, Bash and Python?
Re:Formatting code should be unnecessary by sfn42 on Monday September 08, 2025 @07:56AM (#45167208)
As far as C# goes there's `dotnet format`. You can use it as is or provide an `.editorconfig` file to customize it.