Linting
Also known as: Linter, Lint
Automated checking of source code for likely errors, suspicious constructs and style violations using a tool called a linter.
Linting is the use of automated tools, called linters, to scan source code for problems without running it. A linter flags things that are legal in the language but likely to be mistakes, such as a variable that is declared but never used, a comparison that is always true, a missing case in a switch statement or an accidental assignment where a comparison was intended. Most linters also enforce style rules, such as naming conventions or a maximum line length, so that a codebase stays consistent no matter who wrote each part.
The name comes from lint, a tool Stephen C. Johnson wrote at Bell Labs in 1978 to catch suspicious constructs in C programs that the compiler accepted, named after the small bits of fluff that cling to fabric. Most major languages have descendants: ESLint for JavaScript, Pylint, Flake8 and Ruff for Python, Clippy for Rust and ShellCheck for shell scripts. Linters usually run inside code editors, highlighting problems as code is typed, and in continuous integration pipelines that can block a change from merging until warnings are addressed.
Linting is the simplest and most widely used form of static analysis, and it shifts error detection to the earliest and cheapest point, before code is run or reviewed. Agreeing on linter rules removes many style debates from code review, freeing reviewers for questions of design. Linters have limits: they catch patterns rather than understanding intent, so they produce false positives and miss deeper logic errors, and overly strict configurations can frustrate developers into disabling warnings wholesale. Many teams pair a linter with an automatic formatter that rewrites code to a standard layout.
Key points
- A linter scans source code without running it, flagging likely bugs and style violations.
- The original lint was written by Stephen C. Johnson at Bell Labs in 1978 for C programs.
- Linters typically run in editors and continuous integration pipelines to catch problems early.
- Linters find suspicious patterns but cannot understand intent, so they produce false positives and miss logic errors.
Related entries
Static Analysis
Examination of source code or binaries without executing them, using automated tools to find bugs, security flaws and quality issues.
Code Review
Practice in which developers examine each other's source code changes to find defects, share knowledge and keep the codebase consistent.
Continuous Integration
Development practice in which programmers merge changes into a shared repository frequently, with each change verified by an automated build and tests.
Debugging
Process of finding, diagnosing and fixing defects in software or hardware that cause it to behave incorrectly or unexpectedly.
Bell Labs
Industrial research laboratory, founded in 1925, where the transistor, information theory, Unix and the C programming language were created.
C
General-purpose programming language created by Dennis Ritchie at Bell Labs in the early 1970s, foundational for operating systems and embedded software.
Shell Scripting
Writing programs for a command-line shell, such as Bash, that automate sequences of commands, file operations and system administration tasks.
Referenced by
Other entries that discuss or point to Linting.