DEV Community

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

Collapse
 
thepeoplesbourgeois profile image
Josh • Edited

Seems to me like the linter could worry less about something that's no fault of any developer on the team, and more about ...

🤔

Actually, why do we have tools that make our codebases more opinionated about formatting than the languages themselves are? Do we not trust that we – or our coworkers – are grown adults, with a basic grasp of readable source? How did linters come to rule the world?

Collapse
 
jastuccio profile image
jastuccio • Edited

How did linters come to rule the world?

Our "grown adult co-workers" used to go to war over things like tabs vs spaces, semicolons in JS, and a lot of other stuff. Prettier came along and made an easy to use tool that said "THESE ARE THE RULES. Now be quiet and get back to actual work" I don't think it was even configurable when it came out (or at least severely limited as to what could be customized)

Collapse
 
thepeoplesbourgeois profile image
Josh • Edited

😐

What a stupid thing to go to war over in the first place. They've heard of "writing style" and "aesthetic", right?

Thread Thread
 
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.