A very fast and accurate code counter with complexity calculations, COCOMO/LOCOMO estimates, and unique line metrics written in pure Go.
scc (Sloc, Cloc and Code) is a command‑line tool that counts lines of source code, comments, and blanks across many programming languages. It provides additional metrics like code complexity, COCOMO project cost estimates, and LOCOMO LLM‑based development cost estimates. The tool is designed for speed and accuracy, often outperforming alternatives like cloc and tokei.
Developers, engineering managers, and teams who need to analyze codebases for size, complexity, cost estimation, or maintenance insights. It's especially useful for projects requiring fast, multi‑language code counting with additional metrics.
scc combines extreme speed, accurate multi‑language counting, and unique features like complexity estimation, COCOMO/LOCOMO cost models, and ULOC/DRYness metrics in a single tool. Its Go implementation ensures portability and performance, and it offers multiple output formats for integration into CI/CD pipelines and other tools.
Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
scc is optimized for speed, leveraging multiple CPU cores and often outperforming competitors like tokei and polyglot in benchmarks, as demonstrated in the README's performance section on repositories like CPython and Linux.
It accurately counts code across a wide range of programming languages using a state-machine approach, handling complex cases like verbatim strings in C# and supporting many file extensions.
Beyond basic counts, scc provides complexity estimation, COCOMO project cost modeling, and experimental LOCOMO LLM cost estimates, offering unique insights for project planning and code analysis.
Supports multiple output formats including JSON, CSV, HTML, and OpenMetrics, and exposes a Go API for custom tooling, making it easy to integrate into CI/CD pipelines or other applications.
Complexity estimation is based on simple branch detection without AST parsing, making it unreliable for precise analysis and not comparable across different languages, as admitted in the README.
LOCOMO is an experimental heuristic for LLM costs, not an industry-standard model, and its estimates are rough ballparks that may not account for context reuse or real-world debugging efforts.
Enabling advanced features like ULOC calculation or duplicate detection can significantly increase runtime and memory usage, which might be prohibitive for very large codebases or low-resource environments.
With numerous command-line flags for remapping, filtering, and output formats, mastering all features requires time and can lead to configuration errors, especially for casual users.
scc is an open-source alternative to the following products:
sloccount is a command-line tool for counting source lines of code (SLOC) in software projects, supporting multiple programming languages and generating estimates of development effort and cost.
cloc (Count Lines of Code) is a command-line tool that counts blank lines, comment lines, and physical lines of source code in many programming languages. It helps analyze and compare codebases.
tokei is a command-line tool written in Rust that counts lines of code, comments, and blanks in programming projects across many languages.