A question for people with strong opinions on code-formatting.
Which of these styles do you prefer?
(Poll in next post.)
A question for people with strong opinions on code-formatting.
Which of these styles do you prefer?
(Poll in next post.)
@Edent
"Centered on separator" might be the most cursed thing I've seen since "we don't allow unnecessary semicolons in our codebase".
@Edent Context is key.
I will almost always default to left aligned.
But there are occasions when having a lot of key pairs makes value aligned easier to read.
@Edent I like value aligned, but i hate when there's a really long name that pushes everything way out into the void
@Edent left aligned generally.
value aligned only when the entries are all closely related such that it makes sense to compare values to each other (e.g. โsampledMinโ, โsampledMaxโ, โsampledMeanโ)
@Edent it really does not matter, there are guaranteed to be bigger fires to fight elsewhere ๐
@Edent left-aligned, but without the space to the immediate left of the colon.
Largely because if you fire up Editor X with default settings and format the file, that's what it'll do and I don't fight defaults โ because as @knotnicky says, there are bigger fights elsewhere.
@Edent strong preference for left aligned. Itโs what an auto-formatter will do, and means that when you add key of a different length the diff doesnโt suddenly show your actual new value and a bunch of unrelated changes to the surrounding lines.
@Edent There is no call (IMO) for LTR text to ever be right aligned. Aligning separators makes for easier maintenance by presenting values in a tabular format that is easy for a new pair of eyes to ingest at a glance (easier than having to read and parse each line).
@rgarner @Edent @knotnicky This, plus amending any alignment other than a left alignment becomes a right royal PITA if you have to add items with longer keys / properties to the hash / object / dict (delete as applicable).
@gilesdring @rgarner @Edent @knotnicky "centered on separator" looks nice but it has Premature Optimisation energy, like one day it'll all break because you have a key that's too long or something