There's no reason not to use a linter
August 15, 2021Simply adding a linter to your build pipeline is usually the simplest, cheapest single step you can do to improve code quality.
A linter is a program that anylizes your source code to detect common bugs or other areas for improvement.
Most modern languages come with a wide variety of linters and other static analysis tools available. Pick one. Or pick ten.
If you’re not already doing so, simply adding a linter as the first check in your CI or build pipeline is usually the simplest, cheapest single step you can do to improve code quality, as it can provide a sort of machine-operated code review for you.
While what’s available depends on each language, in general you can, and should, find linters to detect and warn about bugs such as:
- SQL injections
- Common memory leaks
- Uninitialized or unused variables
Additionally, you may want to use linters to detect more stylistic problems that commonly lead to bugs or confusing code:
- Shadowed variables
- Use of conventional naming
- Spell checking of comments or inline documentation
- Unnecessary type conversions
- Excessive indentation
- Unnecessary or redundant conditionals
How to get better at story slicing
How do you avoid days-long pull requests? How do you make your changes smaller?
Should you use git hooks to boost dev productivity?
What are best practices for using git hooks for developer productivity?
Version control all the things!
Keeping configuration in version control is highly correlated with software delivery performance.