DEV Community

Discussion on: 🙏 Please Add .gitattributes To Your Git Repository

 
darrylmelander profile image
Darryl

There were a lot of justifiable reasons these wars happened, and some of them are still valid. Imagine a text editor that interprets a tab as "move to the next column that's a multiple of 8" with no way to configure it to do otherwise. Mix tabs and spaces together and what was nicely lined up for you is completely unreadable to me. Or how about 1 tab = 12 spaces, on an 80 character wide screen? Yeah, that was a thing. These examples aren't an issue any more, but other things are, like code editors that automatically reformat things. If you don't standardize or otherwise keep things in check, you can never tell what actually changed from one commit to the next.

Thread Thread
 
thepeoplesbourgeois profile image
Josh • Edited

Or how about 1 tab = 12 spaces, on an 80 character wide screen? Yeah, that was a thing.

My inkling is that the developer who had that rule was either not using a lot of tabs, using a screen a few more than 80 characters wide, or had some other environmental rationale for why they had adopted what seems, to you and I, an exorbitant amount of spacing for our specific environments. If they were working in a new environment where such spacing was no longer reasonable, or if there was a better standard of spacing in their own environment, I maintain that you (or the colleague who pointed it out to you) found yourself at the crux of a teaching opportunity as opposed to the heart of a war-invoking, crucial difference in the ways different people see the world we share.

I continue to draw countless lessons from the time I spent working at Pivotal, where the Tracker team established the code-formatting rule:

If a pair commits code that's legitimately unreadable, it is a call to reassess our hiring policies, writ large. If it is unfamiliar, but still readable, it is an opportunity to ask and learn why the pair determined the feature necessitated this style for the code. In this case, whether we take the opportunity to learn its motivations or not, if it resolves the ticket and doesn't break integration tests, leave it alone until you have actual work you need to do in that part of the codebase.

(EDIT: My words seem to have reverberated through the collective subconscious [no they didn't] and land in the latest update to Visual Studio Code. In spite of everything else, at least people can say I'm prett yified.)

It might sound crazy to most of the people here, I know, but in short, the way we stopped having endless arguments about code formatting, was to stop having endless arguments about code formatting.