This is a trend that I feel is going to catch on across any language that can support it. It makes trivial decisions and arguments about formatting a thing of the past.
This is a trend that I feel is going to catch on across any language that can support it. It makes trivial decisions and arguments about formatting a thing of the past.
This has been pretty standard practice in the boring ol' enterprise for at least 10 or 15 years.
Java has Checkstyle, with format-on-save support for IntelliJ, Eclipse, and NetBeans at the very least. Visual Studio supports this for all of the .NET languages. Obviously, Golang has `go fmt`. Etc.
Not to be snarky, but whenever a bold new trend seems to be really "catching on"... it's almost always a rehash of something that the enterprise was doing back in the 90's, or academic researchers were writing papers about back in the 70's. The only things that ever really change in this industry are: (1) solutions that were once impractical on old hardware become practical on newer hardware, and (2) solutions that were over-engineered in their original form come back in more user-friendly simplified forms.
Could you point me in a direction to set this up on my system?
FWIW if you use vim, this plugin is great: https://github.com/google/vim-codefmt
There were coding styles, but actually enforcing them wasn't something regularly done (linting is okay), for fear of "bondage & discipline" complaints.
Now the former "rock star" Ruby developers are embracing static typing and Ein Code, Ein Style formatting. Weird.
Personal code formatting preferences is a problem. Devs should just let go of it, once it applies automatically your preferences quickly change.
You can even wire up GitHub etc repos to automatically reject pull requests that add pointless formatting preferences someone will pointedly defend.
Why do Haskell and Elm format lists like this?
type alias Circle =
{ x : Float
, y : Float
, radius : Float
}
...and not like this: type alias Circle = {
x : Float,
y : Float,
radius : Float
}
...? The first makes me shudder with revulsion every time I see it --- that's not where commas go, dammit --- and there must be a reason, which I've never been able to figure out.The Elm style guide mentions in passing that trailing commas require a diff that adds a field to modify two lines but one, but that applies to leading commas too if you add the field at the beginning of the list.
The trailing comma is more easily missed I'd say.
https://github.com/martindemello/crosspad.elm/commit/c67deb4...