Linting is annoying and computers are stupid
Computers do exactly what we tell them, and that’s the problem.
We’re not perfect. We make mistakes. We’re not reliable.
And that’s where linting comes in.
We all know that little red or yellow underline in our text editor, passive-aggressively telling us “You don’t know how to write”, “You have a typo”, or “Your syntax is wrong here.”
Annoying, right?
Linting is a fancy word we use, where in reality this is just using a spell-checker.
The only difference is that it’s not checking human language, but code! And code is just computer language.
Why do we need linting?
A few things it’s useful for:
Error Detection:
Early Detection: Catch syntax errors and potential bugs early.
Code Quality:
Enforcing Standards: Maintain a consistent coding style.
Improved Readability/Consistency: Easier to read and maintain code.
Productivity:
Faster Development: Quickly check for issues and focus on coding.
Reduced Debugging Time: Less time spent fixing issues later.
Collaboration:
Code Reviews: Focus on higher-level concerns.
Security:
Identifying Vulnerabilities: Detect unsafe coding practices.
How do we do this?
We use a linter!
And the steps look something like this:
You then go through the loop as many times as your linter tells you to. You want him happy.
Yet, as annoying as it can be, used well and with intention, it can be critical.
Linting high-risk scripts can help catch errors that would otherwise break production (I learned that one the hard way)
Thank you for reading!
Adeline.
The rabbit hole:
Want to know more and how to get started?
https://ogutdgnn.medium.com/what-is-linting-how-does-a-linter-work-49381f28fc60
https://www.freecodecamp.org/news/what-is-linting-and-how-can-it-save-you-time/
The serendipity trap:
Static code analysis
The art of reasoning about the behavior of computer programs without actually running them. (beautifully said!)
Compilers
Remember I said code is computer language.
Well, there’s more than one language. Worse, there’s high-level and low-level languages. To make them talk and work together? You need a compiler
Configure linters is annoying as well :-) I'd recommend spotless (https://github.com/diffplug/spotless) to reduce the pain.