DEV Community

Jonathan Hall
Jonathan Hall

Posted on • Originally published at jhall.io on

There's no reason not to use a linter

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

If you enjoyed this message, subscribe to The Daily Commit to get future messages to your inbox.

Top comments (0)