22

In the context of programming, a 'linter' is a tool that analyzes code to detect potential code errors or coding anti-patterns or organisational style preferences etc.

To 'lint' is a verb meaning to run the linter.

Dictionaries don't appear to include this usage in their definitions, which is an interesting musing - there are certain words that are invented by the industry that eventually do make it into dictionaries, e.g. debug, script.

Just wondering how this term came about.

1
  • 11
    Heard it for decades but never gave it a thought. I assumed it was by analogy to picking lint off one's clothing Commented May 31, 2024 at 2:44

3 Answers 3

29

The usage of “lint” in computing is derived by analogy from the more common and traditional usage of lint referring to clothing, as suggested below:

Stephen C. Johnson, a computer scientist at Bell Labs, came up with the term "lint" in 1978 while debugging the yacc grammar he was writing for C and dealing with portability issues stemming from porting Unix to a 32-bit machine.

The term was borrowed from the word lint, the tiny bits of fiber and fluff shed by clothing, as the command he wrote would act like a lint trap in a clothes dryer, capturing waste fibers while leaving whole fabrics intact. In 1979, lint programming was used outside of Bell Labs for the first time, in the seventh version (V7) of Unix.

(Wikipedia)

9
  • 1
    If the analogy is removing lint, then why isn't the utility called something like ‘de-lint’?  ‘Lint’ should mean to add fluff. Commented May 31, 2024 at 20:34
  • 23
    @gidds because language is like that sometimes. Weeding the garden doesn't mean adding weeds to it. Commented Jun 1, 2024 at 1:02
  • 6
    @gidds - Ah but this is early and Unix thus commands need to be short to cut down on the typing Commented Jun 1, 2024 at 9:22
  • 2
    @gidds, we also can say we are delinting the code. Commented Jun 1, 2024 at 18:17
  • 11
    @gidds I think it is the more precise option. After all, a lint utility shows lint. It doesn't remove lint. The programmer removes the lint shown by lint. Commented Jun 2, 2024 at 7:44
10

To explicate the (implicit) analogy: The compiler, as part of the compilation process, made sure that you didn't go to work with your underwear over your trousers (no absolutely incorrect code got past it). The linter would pick off little bits of lint that were on your clothes (and probably straighten your tie too) - not absolutely necessary things, but nice to have.

Notice that both compiling and linting are processes done on static code (this is way before JIT-ing), so that's not an important distinction - it was the degree of fastidiousness that's the difference. The compiler only cared that it could make some kind of sense out of your code; the linter had opinions.

2
  • The compiler has opinions too with warnings, so it's kind of a linter. Some warnings are pedantic, but some are almost certainly from user error. Commented Jun 3, 2024 at 16:56
  • Yeah, it depends on what years we're talking about. I've only got experience back to the 1980s, when linting was a separate step. But yes, compilers have absorbed some of the functionality that used to be in lint. Commented Jun 3, 2024 at 17:28
-5

It's an old code validation utility back from when Linux was called Unix and Unix cost money. It's obviously a metaphor of picking lint off clothing.

No, I can't explain WHY that's obvious, and yes, I will be downvoted for that. But I imagine the obviousness explains why it's not documented.

In LISP, it's called a "prettyprinter," and maybe the reason for that isn't obvious either.

4
  • 8
    No, pretty printing is different. But yes, Unix has a utility that is called lint, so I too imagine that the (noun) name of that program is the source of the use as a verb. It is certainly the case that we Unix users talk about “grepping” for some pattern, where grep is used because it is the name of another Unix utility, which searches for regular expressions (a technical term) in files or streams of data. Commented May 31, 2024 at 12:20
  • 6
    Downvoted because Unix and Linux are NOT the same. Linux was designed to LOOK LIKE Unix, but contains no Unix-copyrighted code (so I understand). Commented May 31, 2024 at 14:15
  • 6
    @PeterBill I read that as humor meaning "back when Linux didn't exist and there was a fairly different software ecosystem". Commented May 31, 2024 at 14:44
  • @piojo: Ahh, humor... it is a difficult concept. Commented Jun 1, 2024 at 16:21

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.