Overview on Linters

If you have not heard of linters, don’t worry you are not alone. I took a data science course and did not know about them until after, when a friend mentioned it was a possible interview question. So even if I have not used one, I thought it best I should at least understand what they are and why they are useful.

What is a Linter?

A linter is a tool that looks over code and flags “programming errors, bugs, stylistic errors, and suspicious constructs.”(Wikipedia) As the nature and syntax of languages vary, there are various linters that focus on certain areas for the different programming languages. Some of these, such as programming errors and bugs, can be caught and brought to your attention when you compile the code, but linters can catch them before you compile or execute the code.

When learning about linters, a simple comparison that came to mind to get a basic understanding of a linter would be to compare it to how many word processors have tools such as spell and grammar checkers and word counts. Each of these quickly goes over your writing and points out places where you may have made errors, giving you a chance to fix them before you submit your work. Similarly, linters give you a chance to find errors or bugs in your code before you submit or execute your code

What can a Linter do?

Now that we have talked about what a linter is, let’s talk a bit about the various functions that linters can have. These include giving you metrics or stats about your code, check for bugs or security issues, code aesthetics, and even giving help with code optimization.


Some linters are designed to give you basic and advanced metrics about the code you wrote. They may tell you how many total lines of code you have, lines with comments, blank lines, and more advanced metrics such as cyclomatic(McCabe’s) Complexity or maintainability index.

Security Issues

There are also some linters that are designed to find areas of code that may pose security issues such as SQL injection and can point this out to you before you accidentally execute your code.

Code Aesthetics

Whether you are working on code by yourself or with a team, it is always a good idea to standardize the way you write your code. It makes the code more readable and keeps it looking nice. There are linters that will check your code against a standard code and can keep your code looking nice and constant.

Code optimization

Over time, as you learn more about coding in a particular language, you learn tips and techniques for making your code work better and run faster. But that does not mean you know all the tricks or always remember them, especially if you are somewhat newer with less experience. For that reason, there are even linters out there that can help you find places in your code that you can change to help it better perform, which is useful for any language and any level of programmer.


To sum it all up, linters are tools that can help you better your code in various ways. While a lot of these things, such as debugging and checking for standardized methods of writing code, can be done by yourself, linters help save you time on tedious and time consuming tasks. They are useful tools in both solo and team environments and allow you to focus more on the code and is useful to all levels of programmers. I am not sure how hard they are to use, but I reckon it is worth it especially in the long run. It is also a potential interview question so I hope this helped to give a basic overview on the topic and inspires you to learn more and try them out yourself.