Repository navigation
Home
winlogon edited this page Nov 5, 2025
·
4 revisions
Welcome! This is the quick, practical landing page for the clocscan wiki.
If you already read the README, consider this a compact reference you can use while digging into the code or contributing.
clocscan is a fast, asynchronous lines-of-code counter written in Rust. It traverses a directory tree, filters files by extension, skips configured ignores, and counts SLOC (non-empty, non-comment lines). It tries to be much faster than cloc by using async traversal and non-blocking file IO.
Build (and run):
# build a release binary
cargo build --release
# or use cargo run for quick runs
cargo run --release -- /path/to/projectFull usage is in the README; this wiki focuses on internal structure, notes for contributors, and setting up clocscan (configuration).
-
CLI parsing:
clapparses arguments. -
Logging: A logger is initialized according to
-vverbosity count. -
Load config: clocscan tries to read
./config.json(if it's not found or somehow unaccessible, it falls back to a default config). -
Choose extensions: CLI
-eoverrides config; otherwise extensions from the JSON are used. -
Build file regex: a regex like
.*\.(rs|py|c)$is created to match code files. - Directory walk: the specified folder is walked, yielding entries asynchronously.
- Ignore checks: each path is checked against the configuration to ensure it's not ignored.
- File processing: matching files are opened, read line-by-line, and the contents are passed through a filter to ignore comments/empty lines.
- Accumulate stats: Per-extension counts are collected; and a pretty table showing the results is printed.
NOTE: Docs for the code are published as rustdoc pages at https://walker84837.github.io/clocscan/.
- Contributor's Guide: CONTRIBUTING.md.