Linter Rules: Thoughts on linting your source code

Why should you lint your source code? And what is linting anyways?

A linter is best classified as a static program analysis tool. Casually, a linter or linting refers to tools that analyze source code to find potential logic fallacies, programming errors, bugs, stylistic errors, and suspicious architecture.

Furthermore, the majority of modern programming languages have a linter available as part of a code quality step — some have one built in, some have them as first-party software, others, like JavaScript, might have countless options available. This means you and your team don’t have any excuses about avoiding analyzing your code.

Certainly, most teams will find static code analysis via linting wonderful, as it reduces meatless comments on code reviews and pull requests when new commits or features are littered with problematic code. Linting your source code is also a way to enforce standards or prevent security problems and avoid potential performance issues.

Silicon Valley => Russ Hanneman => Linting

The synopsis:

Monica, Erlich and Richard arrive at Russ’ house for a board meeting. Russ’ young son appears, and a voice on a PA system instructs him to go to bed. Russ explains that the system is called The Lady — a company he’s funding that tells his son when to go to bed, take a bath and so on. “I get to be his friend, and she’s the bad guy,” Russ says, with a smile. “I’ve disrupted fatherhood.”

– via HBO

Static Code Analysis: The Analogy

As a father, I think this is hilarious. As a developer, I think this is hilarious. It’s the same idea as when an experienced person on your team creates the linter rules. A majority of your team agreed on the linter rules, and your team maintains the linter rules.

Therefore, as a team, you all become the house in this example. And as an individual developer on the team, you all become the child when you commit new code, because the linter will yell at you and say, “You didn’t put your curly brace in the right spot!”

Finally, when it comes to a developer’s day-to-day, they will know that the team decided to enforce the rule to put the curly brace there, right? The developer will have to adjust their code to follow the convention! You gotta follow the rules.

“I’m sorry buddy it’s not up to me”

Image for post
Image for post

Originally published at on November 2, 2018.

Father, Husband, Engineer, CTO at Libretto, 15+ yrs of software engineering —

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store