Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

code-scanner

Fast, multi-threaded recursive codebase scanner written in Zig.

It produces:

  • Language/config "utilization" stats (GitHub-like) by bytes (default) or lines
  • Top largest files (bytes) including line counts
  • Top longest files (lines) including byte sizes

Requirements

  • Zig 0.16.0 (or compatible)

Build (Windows x64, single .exe)

This project is set up to build a single executable for x86_64-windows-gnu with static linkage to the C runtime (system DLLs like kernel32.dll are still used as on any Windows program).

From the repo root:

zig build -Doptimize=ReleaseFast -Dtarget=x86_64-windows-gnu

Binary output:

zig-out\bin\code-scanner.exe

Releases (GitHub)

Pushing a tag like v1.2.3 triggers a GitHub Actions workflow that builds binaries for:

  • Linux: x86_64-linux-musl, aarch64-linux-musl
  • macOS: x86_64-macos, aarch64-macos
  • Windows: x86_64-windows-gnu

The GitHub Release includes a SHA256SUMS.txt you can use to verify downloaded artifacts.

Run

Scan current directory:

.\zig-out\bin\code-scanner.exe .

Scan a different path:

.\zig-out\bin\code-scanner.exe C:\path\to\repo

Common workflows

Exclude market data directory and CSV files:

.\zig-out\bin\code-scanner.exe . --exclude-path market_data --exclude-ext csv

Exclude multiple extensions/paths (comma-separated):

.\zig-out\bin\code-scanner.exe . --exclude-ext "csv,parquet" --exclude-path "market_data,dist"

Count utilization by lines instead of bytes (slower; reads files):

.\zig-out\bin\code-scanner.exe . --by lines

Disable built-in ignores (lock files, build/vendor dirs, etc.):

.\zig-out\bin\code-scanner.exe . --no-ignore

Include hidden entries (dotfiles / dotdirs):

.\zig-out\bin\code-scanner.exe . --include-hidden

CLI

code-scanner [path]
  [--by bytes|lines]
  [--top N]
  [--top-files N]
  [--exclude-ext ext1,ext2]
  [--exclude-path pathpart1,pathpart2]
  [--no-ignore]
  [--include-hidden]

Notes:

  • --exclude-ext matches file extensions (case-insensitive), without the dot (e.g. csv, not .csv).
  • --exclude-path matches if the absolute path contains the provided substring (case-insensitive). This is simple and fast; use a distinctive folder name (e.g. market_data).
  • The output bars are ASCII (#/.) to avoid terminal encoding issues on Windows.

Output format

  • Summary: number of detected languages, scanned files, and total metric (bytes/lines)
  • Languages: utilization table with percentages and bars
  • Largest files: sorted by bytes, shows bytes + lines + path
  • Longest files: sorted by lines, shows lines + bytes + path

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages