Skip to content

Writing criteria for this guide

Every "for Mere Mortals" guide is written to the same nine-point standard, so a reader who trusts one can trust the rest. Here it is, with the verification notes for this particular guide below.

  1. Fix it first. Reader outcomes lead, not action items: each chapter opens by naming the outcome it delivers, shows a check the reader can run to confirm they got it, and a reasonable reader finishes able to state what was done, what it means, and what to try next.
  2. Plain language. Short sentences, everyday vocabulary, technical terms defined on first use. No slang, and no idioms that only make sense in one country — the reader may be translating as they go.
  3. No dead ends. A guide never tells the reader to do something it cannot show them how to verify. Every claim a reader relies on — an install, a command, an output — is something this guide demonstrates or clearly labels documented-only below.
  4. Live-verified where it matters. Procedures are run for real in the guide's lab wherever the build machine allows it, and the transcripts kept in the repository are the evidence. What could not be run is listed honestly below, never presented as if it had been.
  5. General audiences. Nothing in this guide — examples, fixtures, names, addresses — is modelled on any particular reader or author's real life, network, or organisations. The lab's traffic is the lab talking to itself.
  6. Standalone. A reader needs this guide, its lab, and nothing else. Where another guide would genuinely help, it is pointed to once, by name, and the chapter still completes without it.
  7. Honest about limits. Chapter 13 names what the tool cannot do: detection that believes names and never reads content (an executable renamed .py counted as 94 lines of Python); prose structurally counted as comments; embedded lines partitioned under one host language and double-counted under another; a counter of syntax that knows nothing of sense, quality or duplication; an answer that depends on the folder's state and the folder you stand in; and this build's own edges — one output format where more are documented, and an -i option that never changed a table.
  8. The one rule is in the text, early. Chapter 1 and the README state the rule plainly — a line count is an answer to a definition — before any procedure depends on it, and later chapters point back to it where a number could be mistaken for a fact of nature: the docstring that is code by one definition and documentation by another, the totals that move when only the filters moved, the claim that dissolved under a pinned definition.
  9. Builds clean. The site builds with MkDocs in strict mode with no warnings, and a fresh reader following the chapters in order reaches the stated outcome of each.

Verification notes for this guide

The build machine is a 2-CPU, 7.7 GB Ubuntu 24.04 sandbox. tokei 15.0.0 ("compiled with serialization support: json") was built from the project's own source with cargo install tokei --locked; the machine's packaged Rust 1.75.0 refused the crate (the edition2024 error quoted in chapter 3), so the toolchain came from rustup — rustc 1.99.1 — and the build took just under five minutes. (A first compile attempt that overlapped a second one failed on a corrupted intermediate artifact; the shipped numbers all come from the clean single build and from runs made after it.) The fixtures are the lab's own, in tokei-lab/fixtures/, each counted by hand before tokei saw it; the hand counts are recorded in examples/lab-notes.txt and every transcript was checked against them. All transcripts live in tokei-lab/transcripts/.

Run for real, with transcripts as evidence:

  • Version (with its formats line), the Rust version it was built with, and the full --help (t00).
  • The first count: the three-file basics tree as a table and per-file, matching the hand counts — C 6/3/1, Python 5/2/3, Markdown prose as comments with its fenced line split out as an embedded Python child (t01).
  • The traps: Python docstrings counted as code, empty line inside the string included (6 code, 0 comments); Rust nested block comments held open to the third line; Rust doc comments reported as embedded Markdown; a web page split into HTML, CSS and JavaScript with a (Total) of 16 for 12 physical lines; --compact folding the children away without changing a total (t02).
  • Detection: Makefile and Dockerfile claimed by filename, an extensionless script claimed by its shebang (which itself counted as a comment), a .txt counted as Plain Text prose, an unknown extension skipped in silence and then named by -v (t03).
  • The filters over an unchanging tree: --hidden admitting a dotfile (4 lines become 6), -e removing a named file, a .tokeignore silencing its file and --no-ignore-dot restoring it (t04, t05).
  • The .gitignore experiment: inert in a plain folder, effective after git init, suspended by --no-ignore-vcs; the throwaway .git was removed after the transcript (t05).
  • Configuration: notes.py at 6 code from the guide root and 1 code / 5 comments from inside the config folder (treat_doc_strings_as_comments); a types line appended, leaving only the Rust file standing, and the file then restored (t06). The config file itself was counted as TOML (1 code, 1 comment).
  • Formats: the JSON document produced and parsed by a second program — top-level sums give 11 code where the Total says 12, the difference traced to a report's blobs; --streaming simple per-file records; the -o yaml refusal quoted in full; -n commas on a large tree (t07, t08).
  • The -i option, tested four ways (file argument and standard input, empty folder and populated one, once more with --files): it never changed a table, and from an empty folder printed zeros rather than the saved counts (t07). The transcript was regenerated after its first capture counted this guide's own still-growing transcript files.
  • Sorting (--sort code reorders the basics table) and the types filter (-t Python isolates one row) (t08).
  • The claim: wc -l reporting 19 (and 0 for the newline-less file) against tokei's 20 lines and 6 code over the same rigged tree (t09).
  • The map and the speed: 334 language rows in --languages; tokei counting its own source folder — 23 files, 7,735 lines, 6,059 code — in 0.022 s of real time (t10).
  • The limits exhibit, run in scratch and not shipped as a fixture: a copy of /bin/true renamed fake.py, counted as 94 lines of Python code (t90).

Documented only — described from the project's documentation, source or --help text, not run, and the text does not claim otherwise:

  • The configuration file's full search order (config folder, home folder, current folder) and its remaining keys (columns, hidden, the no_ignore family, sort), read from the project's configuration definition. The two keys chapters 7 and 10 rely on — treat_doc_strings_as_comments and types — were run and are in the transcripts above.
  • The extra output formats (YAML, CBOR and friends) and the --features builds that enable them: the lab's build has JSON only, and its refusal to write YAML is the transcript's evidence.
  • Installation routes other than the lab's own: package managers, older release binaries (the project's releases carry binaries only up to 12.1.2 — checked against the releases list), and the Windows and macOS wrappings of the cargo route.
  • The neighbouring tools in chapter 12 are characterised, not benchmarked — wc excepted, which chapter 11 runs head-to-head.
  • --columns, --rsort and the JSON variant of --streaming are named from the help text; the table-shaping runs in the transcripts use --sort, -t, -n and --streaming simple.

Fixtures are this guide's own and deliberately generic: a greeter, a C hello-world with a banner comment, shelf notes, a self-counting counter, a pretend container recipe, a label printer with an oversized banner, and one file with no newline at the end. No example is modelled on any real person, network, service or organisation.