Count every line. Know every project.
A fast, dependency-free, cross-platform source code line counter written in C.
Codoco scans your project, detects languages, classifies lines as code / comments / blanks, and produces beautiful terminal, JSON, CSV, XML, or HTML reports.
๐ธ HTML report generated from the Codoco repository itself.
๐ Looking for manual installation and build instructions?
See HOW-TO-BUILD-MYSELF.md
If Codoco saves you time, please consider giving it a โญ on GitHub!
- ๐งญ Overview
- โจ Why Codoco?
- ๐ Features
- โก Quick Start
- ๐ฅ Installation
- ๐ ๏ธ Building From Source
- ๐งช Usage Examples
- ๐ค Output Formats
- โจ๏ธ Command-Line Reference
- ๐ง Language Detection
- ๐ฃ๏ธ Supported Languages
- ๐๏ธ File Filtering and Traversal
- ๐ข How Counting Works
- ๐ฅ๏ธ Supported Platforms
- ๐ Project Layout
- ๐ค Contributing
- ๐ License
- โญ Star / Support
Codoco is a lightweight, high-performance code statistics tool designed to give you an instant, clear picture of any codebase.
Point it at a directory, a set of files, or a whole repository, and Codoco will:
- ๐ Recursively scan source files
- ๐ง Detect programming languages by extension, filename, or shebang
- ๐งฎ Count lines, code lines, comment lines, blank lines, and bytes
- ๐ซ Skip binary files and common build/dependency directories
- ๐ฆ Produce polished reports for humans and machines
Codoco is especially useful for:
- ๐ Repository size analysis
- ๐ CI dashboards
- ๐ Documentation generation
- ๐ Codebase audits
- ๐ Language distribution reports
- ๐ Per-file inspection
- ๐งพ Quick statistics for pull requests or project reviews
Many line counters exist โ but Codoco aims to be:
Written in pure C with minimal overhead, Codoco is designed for speed and low memory usage.
The final binary only needs the standard C library and POSIX-compatible system interfaces. No Python, Node.js, Ruby, or runtime dependencies are required.
Codoco supports Linux, macOS, Windows, and Termux across many CPU architectures.
From clean terminal tables to polished HTML reports with charts, Codoco makes statistics readable and shareable.
Codoco does not only look at extensions. It also understands special filenames like Makefile, Dockerfile, CMakeLists.txt, Gemfile, .gitignore, and more. It can even inspect shebang lines and apply a C/C++ header heuristic.
JSON, CSV, and XML outputs make Codoco easy to integrate into tooling, dashboards, and automation pipelines.
- ๐ 180+ built-in language definitions
- ๐ฅ๏ธ Terminal-first design
- Adaptive table layout based on terminal width
- Unicode box drawing with ASCII fallback
- Optional color output
- ๐ค Multiple output formats
- Table
- JSON
- CSV
- XML
- HTML
- ๐ HTML reports
- Dark and light themes
- Responsive layout
- Donut chart for language distribution
- Print-friendly styling
- ๐ Per-file reporting
- ๐ Sorting and limiting
- Sort by name, files, lines, code, comments, blanks, or bytes
- Ascending/descending order
- Top-N results
- ๐ฏ Powerful filtering
- Include/exclude languages
- Include/exclude extensions
- Exclude directories with glob patterns
- Minimum/maximum file size filters
- ๐งน Smart scanning behavior
- Binary file detection
- Default ignore list for common build and dependency directories
- Hidden file control
- Symlink traversal control
- Depth-limited recursion
- ๐ฅ Robust installer
- One-line install for Unix-like systems
- PowerShell installer for Windows
- Checksum verification support
codoco .codoco --sort=code --top=10 .codoco --html -o report.html .This produces theme-specific HTML files such as:
report-dark.html
report-light.html
codoco --json . > codoco.jsoncodoco --by-file --sort=bytes --order=desc .codoco --include-lang="C,C++,Python,Shell" .codoco --exclude-dir="vendor,third_party,docs" .Codoco provides simple installers for Unix-like systems and Windows.
For manual installation, release extraction, building from source, Make usage, and troubleshooting, see:
Install the latest release:
curl -fsSL https://raw.githubusercontent.com/RaptorVampire/Codoco/main/install.sh | shThe installer will:
- ๐งญ Detect your OS and architecture
- โฌ๏ธ Download the correct release artifact
- โ Verify checksum when available
- ๐ Install the binary into
$HOME/.local/binby default - ๐ค๏ธ Update your shell PATH if possible
| Variable | Default | Description |
|---|---|---|
VERSION |
latest |
Install a specific tag, e.g. v1.0.0 |
PREFIX |
$HOME/.local |
Installation prefix |
BINDIR |
$PREFIX/bin |
Binary destination directory |
YES=1 |
disabled | Skip confirmation prompt |
FORCE=1 |
disabled | Reinstall even if already installed |
UNINSTALL=1 |
disabled | Remove Codoco |
NO_PATH=1 |
disabled | Do not modify shell rc files |
NO_VERIFY=1 |
disabled | Skip checksum verification |
Install a specific version:
curl -fsSL https://raw.githubusercontent.com/RaptorVampire/Codoco/main/install.sh | VERSION=v1.0.0 shInstall system-wide:
curl -fsSL https://raw.githubusercontent.com/RaptorVampire/Codoco/main/install.sh | sudo PREFIX=/usr/local BINDIR=/usr/local/bin shAssume yes and skip PATH modification:
curl -fsSL https://raw.githubusercontent.com/RaptorVampire/Codoco/main/install.sh | YES=1 NO_PATH=1 shUninstall:
curl -fsSL https://raw.githubusercontent.com/RaptorVampire/Codoco/main/install.sh | UNINSTALL=1 shInstall the latest release:
irm https://raw.githubusercontent.com/RaptorVampire/Codoco/main/install.ps1 | iexBy default, Codoco is installed to:
%LOCALAPPDATA%\Programs\Codoco
and added to your user PATH.
| Option | Description |
|---|---|
-Version |
Install a specific release tag |
-InstallDir |
Installation directory |
-Uninstall |
Remove Codoco |
-NoPath |
Do not modify PATH |
-Force |
Reinstall even if already installed |
-NoVerify |
Skip checksum verification |
Open a new terminal after installation so PATH changes take effect.
If you want to compile Codoco yourself, install it manually, use Make targets, build packages, or debug build problems, read the full guide here:
That guide includes:
- ๐งฑ Building with
make - ๐งฐ Direct compilation without Make
- ๐ฅ Manual release installation
- ๐ฆ Local
.deb/.rpmpackaging - ๐งช Smoke tests
- ๐ฉน Troubleshooting
codoco .codoco src include testscodoco --top=15 .codoco --sort=files --order=desc .codoco --by-file .codoco --by-file --sort=bytes --top=25 .codoco --include-lang="C,C++,Python" .codoco --exclude-lang="Markdown,JSON" .codoco --include-ext="c,h,cpp,hpp" .codoco --exclude-dir="build,*cache*,third_party" .Include hidden files
codoco --hidden .codoco --depth=2 .codoco --no-recursive .codoco --follow .codoco --force-lang=Python .Useful for legacy terminals or CI logs:
codoco --ascii --no-color .codoco --color .codoco --no-bar --no-percent .codoco --quiet .Codoco supports five output formats.
| Format | Best For |
|---|---|
table |
Human-readable terminal output |
json |
APIs, dashboards, tooling |
csv |
Spreadsheets and data analysis |
xml |
Legacy integrations and structured reports |
html |
Shareable visual reports |
The default output is an adaptive terminal table.
It includes:
- ๐ท๏ธ Project banner
- ๐ Scan statistics
- ๐ Language table
- โ Total summary
- ๐ Optional language distribution bars
- ๐ Optional per-file report
The terminal renderer is width-aware:
- It avoids wrapping
- It truncates long values safely
- It falls back to ASCII when requested
- It supports Unicode box drawing when available
Example:
codoco .Generate structured JSON output:
codoco --json .Example structure:
{
"tool": "Codoco",
"version": "1.0.0",
"url": "https://github.com/RaptorVampire/Codoco",
"license": "Apache-2.0 OR MIT",
"summary": {
"files": 123,
"lines": 45678,
"code": 34567,
"comments": 6789,
"blanks": 4321,
"bytes": 1234567
},
"languages": [
{
"name": "C",
"files": 40,
"lines": 20000,
"code": 15000,
"comments": 3000,
"blanks": 2000,
"bytes": 700000
}
]
}With --by-file, a files array is also included:
codoco --json --by-file .Generate CSV output:
codoco --csv .Default columns:
Language,Files,Lines,Code,Comments,Blanks,Bytes,Percent
With --by-file, an additional per-file section is emitted:
Path,Language,Lines,Code,Comments,Blanks,Bytes
Generate XML output:
codoco --xml .Example:
<?xml version="1.0" encoding="UTF-8"?>
<codoco tool="Codoco" version="1.0.0" url="https://github.com/RaptorVampire/Codoco" license="Apache-2.0 OR MIT">
<summary files="123" lines="45678" code="34567" comments="6789" blanks="4321" bytes="1234567"/>
<languages>
<language name="C" files="40" lines="20000" code="15000" comments="3000" blanks="2000" bytes="700000" percent="43.79"/>
</languages>
</codoco>Codoco can generate a polished standalone HTML report.
codoco --html .By default, both dark and light themes are generated:
codoco-report-dark.html
codoco-report-light.html
Specify a base output name:
codoco --html -o report.html .This produces:
report-dark.html
report-light.html
Choose a theme:
codoco --html --theme=dark .
codoco --html --theme=light .
codoco --html --theme=both .- ๐จ Modern dashboard-like layout
- ๐งฎ Summary cards for files, lines, code, comments, blanks, and size
- ๐ฉ SVG donut chart for language share
- ๐ Legend with percentages
- ๐ Full language table
- ๐ Dark and light themes
- ๐ฑ Responsive mobile layout
- ๐จ๏ธ Print-friendly CSS
This makes Codoco especially useful for:
- ๐ Project documentation
- ๐ Internal dashboards
- ๐ Code review summaries
- ๐ Open-source repository reports
- ๐ค Shareable statistics without installing additional tools
Usage: codoco [OPTIONS] [PATH...]
If no path is given, Codoco scans the current directory.
| Option | Description |
|---|---|
--format=FMT |
Output format: table, json, csv, xml, html |
--json |
Shortcut for --format=json |
--csv |
Shortcut for --format=csv |
--xml |
Shortcut for --format=xml |
--html |
Shortcut for --format=html |
-o, --output=FILE |
Base output path for HTML reports |
--theme=MODE |
HTML theme: dark, light, both |
--by-file |
Include per-file report |
--no-bar |
Hide bar charts in terminal output |
--no-percent |
Hide percentages |
--no-total |
Hide total row |
--no-header |
Hide table headers |
--ascii |
ASCII-only output |
--no-color |
Disable ANSI colors |
--color |
Force ANSI colors |
--top=N |
Show only top N entries |
-q, --quiet |
Suppress non-essential messages |
| Option | Description |
|---|---|
--sort=KEY |
Sort key: name, files, lines, code, comments, blanks, bytes |
--order=ORD |
Sort order: asc or desc |
Default:
--sort=lines --order=desc
| Option | Description |
|---|---|
--include-lang=L |
Only include languages in comma-separated list |
--exclude-lang=L |
Exclude languages in comma-separated list |
--include-ext=L |
Only include extensions in comma-separated list |
--exclude-ext=L |
Exclude extensions in comma-separated list |
--exclude-dir=L |
Exclude directory names using comma-separated globs |
--max-file-size=N |
Skip files larger than N bytes |
--min-file-size=N |
Skip files smaller than N bytes |
--force-lang=LANG |
Treat every scanned file as the given language |
| Option | Description |
|---|---|
-r, --recursive |
Recursive scan, enabled by default |
--no-recursive |
Disable recursion |
-d, --depth=N |
Maximum recursion depth |
--hidden |
Include hidden files and directories |
--follow |
Follow symbolic links |
| Option | Description |
|---|---|
-h, -?, -help, --help |
Show help |
-v, --version |
Show version |
--license |
Show license information |
--list-langs, --langs |
List supported languages |
Codoco uses a layered detection strategy.
-
๐ฏ Forced language
- If
--force-langis used, Codoco applies it.
- If
-
๐ Filename rules
- Special files are recognized by name.
- Examples:
MakefileDockerfileCMakeLists.txtGemfileRakefilepackage.jsonCargo.tomlgo.mod.gitignore.editorconfigVagrantfileJenkinsfile
-
๐งฉ File extension
- Most languages are detected by extension.
- Extension matching is case-insensitive.
-
๐งช C/C++ header heuristic
.hfiles are treated as C by default.- If a sibling C++ source file exists, Codoco reclassifies the header as C++.
-
๐ Shebang detection
- If no language is found, Codoco checks the first line for a shebang.
- Examples:
#!/usr/bin/env python3#!/bin/bash#!/usr/bin/env node
-
๐ Fallback
- Text-like files without a recognized language are treated as
Text.
- Text-like files without a recognized language are treated as
Codoco ships with 180+ built-in language definitions.
You can always list them locally with:
codoco --list-langs- C
- C++
- Rust
- Zig
- D
- Ada
- Pascal
- Fortran
- Assembly
- Python
- Ruby
- JavaScript
- TypeScript
- Java
- Kotlin
- Scala
- C#
- Go
- PHP
- Dart
- Lua
- Perl
- Raku
- HTML
- CSS
- SCSS
- SASS
- LESS
- Markdown
- reStructuredText
- AsciiDoc
- XML
- JSON
- YAML
- TOML
- Shell
- Bash
- Zsh
- Fish
- PowerShell
- Batch
- VBScript
- AWK
- Sed
- Tcl
- R
- MATLAB
- Octave
- Julia
- Wolfram
- SAS
- Stata
- SPSS
- Dockerfile
- Makefile
- CMake
- Meson
- Bazel
- Gradle
- Terraform
- HCL
- Nix
- Puppet
- INI
- TOML
- YAML
- Verilog
- SystemVerilog
- VHDL
- CUDA
- OpenCL
- GLSL
- HLSL
- SQL
- GraphQL
- Protocol Buffers
- Thrift
- LLVM IR
- WebAssembly
- COBOL
- Lisp
- Haskell
- OCaml
- Erlang
- Elixir
- Prolog
The authoritative list is always available via:
codoco --list-langsCodoco is designed to avoid noise.
By default, Codoco skips common generated and dependency directories such as:
.git.hg.svnnode_modulesvendor__pycache__.pytest_cache.mypy_cache.venvvenvtargetbuilddistoutbinobj.idea.vscode.gradle.cargoDerivedData.next.nuxtcoverage
Codoco automatically skips many binary file types, including:
- ๐งฑ Executables and object files
- ๐๏ธ Archives
- ๐ผ๏ธ Images
- ๐ต Audio/video
- ๐ค Fonts
- ๐ Documents
- ๐๏ธ Databases
- ๐ฆ Compiled artifacts
Additional binary detection is performed by scanning file contents for NUL bytes.
Hidden files
Hidden files and directories are excluded by default.
Include them with:
codoco --hidden .Symlinks are not followed by default.
Follow them with:
codoco --follow .Codoco uses a lightweight line classification engine.
Each line is classified as one of:
- ๐ป Code
- ๐ฌ Comment
- โฌ Blank
- A line containing only whitespace is counted as blank.
- A line containing code is counted as code, even if it also contains a trailing comment.
- A line containing only comment syntax is counted as comment.
- Block comments are recognized where supported by the language definition.
- String literals and escapes are considered during classification.
- Language-specific line comment markers are respected.
- Block comment start/end markers are respected.
For C-like code:
int main(void) {
// start program
return 0;
}Typical classification:
int main(void) { -> code
// start program -> comment
return 0; -> code
} -> code
Codoco is not a full compiler or parser.
It uses fast, practical heuristics that are well suited for project statistics, trend reporting, and repository analysis.
Codoco targets a wide range of operating systems and architectures.
linux-x86_64linux-i686linux-aarch64linux-armv7linux-riscv64linux-x86_64-static
macos-x86_64macos-arm64
windows-x86_64windows-i686
Codoco also works in:
- ๐ฑ Termux on Android
- ๐งฐ MSYS2 / MinGW environments
- ๐ฆ Containers and minimal Linux systems
Codoco/
โโโ include/ # Public headers
โ โโโ codoco.h
โ โโโ languages.h
โ โโโ options.h
โ โโโ printer.h
โ โโโ scanner.h
โ โโโ stats.h
โ โโโ utils.h
โ โโโ version.h
โโโ src/ # Implementation
โ โโโ languages.c
โ โโโ main.c
โ โโโ options.c
โ โโโ printer.c
โ โโโ scanner.c
โ โโโ stats.c
โ โโโ utils.c
โโโ install.sh # Unix installer
โโโ install.ps1 # Windows installer
โโโ Makefile
โโโ Screenshot.png # HTML report preview shown above
โโโ HOW-TO-BUILD-MYSELF.md
โโโ LICENSE-APACHE
โโโ LICENSE-MIT
Contributions are very welcome!
You can help by:
- ๐ Reporting bugs
- ๐ก Suggesting features
- ๐ Improving documentation
- ๐ Adding language definitions
- ๐ง Fixing edge cases in counting logic
- ๐ฆ Improving installers and packaging
Before submitting a pull request, please read the build guide if your change affects compilation or packaging:
make clean
make CFLAGS+="-Werror"
./codoco --no-color --ascii .If you add or modify counting behavior, please include practical examples of before/after behavior in your pull request.
Codoco is dual-licensed.
You may use it under either:
- Apache License, Version 2.0
- MIT License
SPDX identifier:
Apache-2.0 OR MIT
Full license texts are provided in:
LICENSE-APACHELICENSE-MIT
If Codoco helps you understand your projects faster, please consider starring the repository.
Your star helps the project grow, motivates continued development, and helps others discover Codoco.
If you find Codoco useful, please โญ the repo!