Skip to content

Limits

By the end of this chapter you can recite what a tokei count cannot tell you, however fast it arrives. Every limit here was met in the lab, not read in a manual.

Detection believes names

The detector never asks what a file is — only what it is called, what it ends with, and what its first line says. Chapter 5's Python-in-a-.txt was counted as prose. The complement is worse: the lab copied an ordinary executable program, renamed it fake.py, and tokei counted it, cheerfully, as 94 lines of Python code (transcript tokei-lab/transcripts/t90-limits.txt). There is no content check to fail. If a tree contains binaries wearing source-code names, the totals contain them too.

Prose counts as comments

For Markdown and Plain Text — and, in a sense, for any prose — the Code column is structurally near zero: lines are comments unless they are embedded code. "How much Markdown code is in this documentation project" is a question tokei's definition makes meaningless, and the honest answer is a comment count and an embedded count, quoted as such.

Embedded lines are not accounted one way

Chapter 7's two specimens disagreed: the web page's embedded lines were counted twice (16 total for 12 physical lines), the Markdown file's were partitioned (8 for 8). Which treatment a file gets depends on its host language's definition. Before quoting a tree total that contains web pages or docs, check it against a physical line count.

A count is syntax, not sense

The counter cannot tell hand-written code from generated code, a careful function from a pasted duplicate, or a live line from a dead one that merely parses. A minified bundle is one line; a file of nothing but imports is all code. Tokei measures the shape of text. Quality, difficulty and value live elsewhere, and neither chapter 11's procedure nor any other can promote a count into a judgement of them.

The answer depends on the room it was counted in

Whether the tree is a git repository, which folder you stood in, what its tokei.toml says, which switches were set — chapter 8 and 10 showed each one moving a total over an unchanged tree. A tokei count quoted without its conditions is a number with its definition filed off, and chapter 1's rule applies to it in full.

This build's edges

What a given tokei binary can do depends on how it was built: the lab's build writes JSON and refuses YAML with instructions to rebuild (chapter 9), and its -i option, tested four ways, never changed a table (also chapter 9). A newer, older or differently built tokei may behave better in both places; the limits belong to the build the lab ran, and the guide says which build that was wherever it matters.

Check: a colleague quotes "the docs folder: 4,000 lines of Markdown code". Using this chapter, name two reasons the sentence cannot be right as stated. If both came from the rules you met in the lab, you have this chapter.