Skip to content

Latest commit

 

History

History
133 lines (83 loc) · 2.38 KB

File metadata and controls

133 lines (83 loc) · 2.38 KB

tokei

tokei analyzes source code and reports file counts, lines of code, comments, and blank lines by language.

It is useful for obtaining a quick quantitative overview of a repository.

tokei language breakdown for the mac-dev-setup repository

The tool is installed through Homebrew and declared in the project Brewfile.

Installation

It is part of the curated Homebrew environment; see Homebrew setup to install everything at once.

Install tokei directly:

brew install tokei

Verify the installation:

tokei --version
brew list --formula | grep -x tokei

Usage

Analyze the current directory:

tokei .

Analyze a specific project:

tokei ~/Documents/Projects/my-project

Display the files included in the analysis:

tokei --files .

Excluding directories

Generated files and dependencies can distort the result.

Exclude common project directories:

tokei \
  --exclude '.git' \
  --exclude 'vendor' \
  --exclude 'node_modules' \
  --exclude 'var' \
  .

For a Symfony project, excluding vendor and var is especially important.

Output formats

Display the result as JSON:

tokei --output json .

Display the result as YAML:

tokei --output yaml .

Structured output can be used in scripts, reports, or automated checks.

Useful use cases

tokei is useful for:

  • tracking project growth over time;
  • comparing branches or project versions;
  • detecting unexpectedly large generated directories.

Interpretation

Line counts measure size, not quality — treat them as a rough indicator.

Safety

tokei is read-only.

It scans files and reports statistics without modifying the repository.

Be careful when exporting or sharing results from private projects because language distribution and file structure can reveal implementation details.

Troubleshooting

Display all options:

tokei --help

Confirm the executable path:

command -v tokei

If the result includes unwanted generated files, add explicit exclusions:

tokei --exclude 'path-to-ignore' .

Rollback

Remove tokei with Homebrew:

brew uninstall tokei

Then remove its entry from profiles/full/Brewfile.


← Docs index · Project README