sloc is a simple, fast tool for counting lines of code that’s designed to be used from both the command line and Node.js scripts. It tallies physical lines, source lines, comment lines, and blank lines, giving you a quick snapshot of code size across files or entire directories. The utility is language-aware through lightweight detectors and patterns, so it can ignore comments correctly and avoid counting generated or minified files if you configure it to. Output can be human-readable for quick checks or machine-readable (like JSON) for CI pipelines that track repository growth over time. It supports typical developer conveniences such as glob patterns, file/directory ignores, and sensible defaults so you can drop it into existing workflows without fuss. Teams often wire sloc into build steps to watch trends, compare modules, or enforce thresholds before merging changes, making it a handy maintenance metric rather than a vanity number.

Features

  • Counts physical lines, source code lines, single-line comments, block comments, mixed source/comment lines, and empty lines
  • Detects lines containing TODOs
  • Outputs results as plain table, CSV, or JSON
  • Can be used via CLI or as a Node.js module in projects
  • Installable globally (npm install -g sloc) or locally as a dependency
  • Lightweight and streamlines SLOC analysis

Project Samples

Project Activity

See All Activity >

Categories

Code Editors

License

MIT License

Follow SLOC

SLOC Web Site

Other Useful Business Software
Auth0 for AI Agents now in GA Icon
Auth0 for AI Agents now in GA

Ready to implement AI with confidence (without sacrificing security)?

Connect your AI agents to apps and data more securely, give users control over the actions AI agents can perform and the data they can access, and enable human confirmation for critical agent actions.
Start building today
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of SLOC!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

CoffeeScript

Related Categories

CoffeeScript Code Editors

Registered

2025-08-22