| name | cloc |
| description | Count lines of code, blank lines, comment lines, and files by language. Use when quickly assessing the size, complexity, and composition of a repository during an audit. |
cloc — Code Line Counter
Basic Usage
cloc .
cloc ./src
cloc /path/to/repo1 /path/to/repo2
Common Options
cloc . --csv
cloc . --json
cloc . --yaml
cloc . --exclude-dir=node_modules,.git,build,dist
cloc . --by-file
cloc . --code-only
When to Use
- Initial assessment of a repository's size and language distribution
- Compare repository composition against benchmarks
- Identify areas with high code volume (potential maintenance burden)
- Fill in
profile.json with language statistics
Examples
cloc . --json --out=cloc.json
cloc . --exclude-dir=node_modules,.venv,__pycache__,vendor,.git
cloc . --quiet
Output Fields
| Field | Description |
|---|
Language | Programming language |
files | Number of files |
blank | Blank lines |
comment | Comment lines |
code | Actual code lines |
SUM | Totals row |