# scc
**Sloc Cloc and Code** — high-performance code analysis tool written in Go. Counts lines of code, comments, blanks, and estimates complexity across 100+ languages.
## Key Features
**Code Analysis:**
- Counts source lines, blank lines, comments, and physical lines across **100+ languages**
- Identifies and ignores generated or minified files
- Detects duplicate code across projects
- Calculates **cyclomatic complexity** approximations
- Computes **Unique Lines of Code (ULOC)** and **DRYness metrics**
**Output Flexibility:**
- Multiple formats: tabular, JSON, CSV, HTML, SQL, CLOC-YAML compatibility
- Configurable for scripting and CI/CD integration
## Why It's Fast
1. **Minimal State Machine** — lightweight state tracking instead of full AST parsing
2. **Parallel Processing** — configurable worker goroutines for concurrent file processing
3. **Efficient I/O** — handles large-scale scanning without degradation
4. **Low Overhead** — complexity calculations use simple keyword lookups
Performance: Significantly faster than cloc and Tokei on large datasets.
## Installation
```bash
# Go
go install github.com/boyter/scc/v3@latest
# Package managers
brew install scc
snap install scc
scoop install scc
choco install scc
# Docker
docker run --rm -it -v "$PWD:/pwd" ghcr.io/boyter/scc:master scc /pwd
```
Pre-compiled binaries available for Windows, Linux, and macOS.
## Usage Examples
```bash
# Basic usage
scc . # Current directory
scc /path/to/project # Specific directory
# Output formats
scc --format json . # JSON output
scc --format csv . # CSV output
scc --format html -o report.html . # HTML report
# Advanced options
scc --by-file . # Per-file breakdown
scc --include-ext go,js,py . # Specific file types
scc --exclude-dir vendor,node_modules . # Exclude directories
scc --no-complexity . # Skip complexity calculations
scc --no-duplicates . # Skip duplicate detection
# Complexity and metrics
scc --complexity . # Show complexity (default)
scc --uloc . # Show Unique Lines of Code
```
## Unique Advantages
- **Accurate String Handling** — correctly processes verbatim strings (e.g., C# `@` prefix) where other tools fail
- **Ignore File Support** — recognizes `.gitignore` and `.sccignore` for selective exclusion
- **Complexity Estimation** — approximates cyclomatic complexity by counting branch operations
- **COCOMO Projections** — calculates estimated development costs, schedule effort, and team size
## Real-World Usage
Powers production systems at:
- SearchCode
- Intel Nemu Hypervisor tracking
- CodeQL analysis
- GitLab CI/CD pipelines
Processes billions of lines annually across major code hosting platforms.
## When to Use scc
Best for:
- Fast scans of **large repos** (multi-core optimization)
- **Modern language** support (actively maintained)
- **Complexity analysis** and technical debt assessment
- **CI/CD integration** (fast + multiple output formats)
- **Historical tracking** without proprietary dependencies
---
See also: [[cloc]], [[Tokei]], [[Counting Lines of Code]], [[Ruff]]