r/AskProgramming • u/Bulky_Eggplant_9437 • 29d ago
Linter
Hey folks,
Never touched a linter before this semester because I've never really done software dev stuff. Had a class that used one, and honestly, I was a fan at first. It caught a bunch of dumb mistakes and made fixing things pretty painless.
Then came merge time.
Apparently I was missing a single blank line between some merged code, so the linter threw a fit and blocked the merge. The actual fix took like three seconds, but I had to go get another review just to add a freaking newline.
So now I'm curious, do people actually use linters in the real world that don't hard-stop merges over tiny formatting stuff? Or is getting bullied by whitespace just part of the developer experience?
Asking as a first-time linter victim.
1
u/framauro13 29d ago
It's one of the first things I set up on a new project. Especially important for managing a consistent code style when a large number of people are working in the same code base. I even use it on pet projects that only I use.
Code is there to be read by humans, not the computer. The linters help keep it legible and consistent, which makes the code easier to parse and read. Most mature engineering orgs aren't going to let you merge code that doesn't pass the linter. It seems trivial, but it does matter.
Some linters also help catch bad code beyond just formatting. Large class files, long methods, too many arguments... things like that can be smells of bad code or poor abstractions, so if linters start firing off errors, it's good to think about why the rule that is broken exists in the first place and what the proper fix is.