Linters catch problems without executing code; tests catch problems only when the code is executed; both are needed and neither replaces the other.
Aspect | Lint (static) | Tests (runtime) |
|---|---|---|
Requires execution | No | Yes |
Speed | Milliseconds | Seconds to hours |
Catches syntax errors | Yes | Only if the code reaches them |
Catches logic errors | Sometimes, by pattern | Yes, if a test covers them |
Catches performance issues | Rarely | Sometimes, under load |
False positives | Common | Rare |