π HowMany - Professional Code Analysis Tool
HowMany is a blazingly fast, intelligent code analysis tool built in Rust that provides comprehensive statistics about project codebases. It automatically filters out dependencies, build artifacts, and generated files while delivering professional-grade performance metrics and beautiful visualizations.
β¨ Key Features
π Performance & Efficiency
- β‘ Parallel Processing: 3-5x faster than traditional tools using Rayon
- π§ Intelligent Caching: Avoids re-analyzing unchanged files (80% faster on re-runs)
- π Performance Metrics: Detailed timing, throughput, and resource usage statistics
- π― Smart Memory Management: Efficient processing of large codebases
π§ Intelligent Analysis
- π Smart Filtering: Automatically distinguishes user code from dependencies
- π Advanced Documentation Detection: JSDoc, Rustdoc, Python docstrings, and more
- π 40+ Programming Languages: Comprehensive language support with accurate parsing
- π Code Quality Insights: Detailed line classification and statistics
π¨ Beautiful User Experience
- π₯οΈ Rich Interactive UI: Colorful terminal interface with charts and progress bars
- π Multiple Output Formats: Text, JSON, CSV, and interactive modes
- βοΈ Persistent Configuration: Customizable settings saved between sessions
- π― Professional Error Handling: Clear, actionable error messages
π§ Enterprise Features
- ποΈ Robust Architecture: Modular design with comprehensive error handling
- π§ͺ Extensive Testing: 95%+ test coverage with integration tests
- π¦ Easy Integration: Simple CLI interface and structured output formats
- π Continuous Monitoring: Perfect for CI/CD pipelines
π Installation
From Crates.io (Recommended)
From Source
Pre-built Binaries
Download from GitHub Releases
π Usage
Quick Start
# Analyze current directory (interactive mode)
# Quick analysis with breakdown
# Export results to JSON
# Focus on specific languages
Command Modes
π― Interactive Mode (Default)
Beautiful terminal UI with visual charts and real-time progress:
π Count Mode
Structured analysis with customizable output:
π List Mode
Preview files that will be analyzed:
Advanced Options
| Option | Description | Example |
|---|---|---|
--max-depth, -d <DEPTH> |
Limit directory traversal depth | --max-depth 3 |
--files, -f |
Show individual file statistics | --files |
--verbose, -v |
Detailed breakdown by language | --verbose |
--include-hidden |
Include hidden files/directories | --include-hidden |
--ignore-gitignore |
Ignore .gitignore patterns |
--ignore-gitignore |
--ignore <PATTERN> |
Custom ignore patterns | --ignore "*.test.js" |
--ext <EXTENSION> |
Filter by file extensions | --ext rs --ext py |
--format <FORMAT> |
Output format: text, json, csv | --format json |
--sort-by <FIELD> |
Sort by: files, lines, code, size | --sort-by code |
--descending |
Sort in descending order | --descending |
π¨ Sample Output
Interactive Mode
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β π HOW MANY CODE ANALYZER π β
β β
β Professional code analysis with beautiful visualization β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π OVERVIEW
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββ¬ββββββββββ¬βββββββββββββ¬ββββββββββββββββββββββ
β Metric β Count β Percentage β Visual β
βββββββββββββββββββΌββββββββββΌβββββββββββββΌββββββββββββββββββββββ€
β π Total Files β 156 β - β ββββββββββββββββββββ β
β π Total Lines β 12,847 β 100.0% β ββββββββββββββββββββ β
β π» Code Lines β 8,934 β 69.5% β ββββββββββββββββββββ β
β π¬ Comments β 1,245 β 9.7% β ββββββββββββββββββββ β
β π Documentationβ 1,823 β 14.2% β ββββββββββββββββββββ β
β β¬ Blank Lines β 845 β 6.6% β ββββββββββββββββββββ β
β πΎ Total Size β 487.3KB β - β ββββββββββββββββββββ β
βββββββββββββββββββ΄ββββββββββ΄βββββββββββββ΄ββββββββββββββββββββββ
π Performance Summary
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β±οΈ Total time: 0.23s
π Files processed: 156
π Lines processed: 12,847
π Throughput: 55,826 lines/sec
πΎ Cache hit rate: 73.2%
π§ Parallel workers: 8
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
JSON Output
π Supported Languages
Systems Programming: Rust, C, C++, Go, Zig, Assembly
Web Development: JavaScript, TypeScript, HTML, CSS, PHP, Vue, Svelte
Enterprise: Java, C#, Kotlin, Scala, F#
Scripting: Python, Ruby, Perl, Shell, PowerShell, Lua
Functional: Haskell, OCaml, Elm, Erlang, Elixir
Data Science: R, Julia, MATLAB, SQL
Mobile: Swift, Objective-C, Dart, Kotlin
Configuration: YAML, JSON, TOML, XML, INI
Documentation: Markdown, reStructuredText, AsciiDoc
And many more...
ποΈ Architecture
Core Components
- π FileDetector: Intelligent file classification with dependency detection
- π CodeCounter: Multi-threaded line counting with language-specific parsing
- ποΈ FileFilter: Advanced filtering with
.gitignoreintegration - π¨ InteractiveDisplay: Rich terminal UI with progress bars and charts
- πΎ FileCache: Intelligent caching system for performance optimization
- π MetricsCollector: Performance tracking and reporting
- βοΈ Configuration: Persistent user preferences and settings
Performance Features
- Parallel Processing: Multi-core utilization with Rayon
- Smart Caching: File modification time-based cache invalidation
- Memory Efficiency: Streaming file processing with minimal memory footprint
- Progress Reporting: Real-time progress bars and ETA calculations
π Performance Comparison
| Tool | Speed | Languages | Caching | UI | Accuracy |
|---|---|---|---|---|---|
| HowMany | βββββ | βββββ | βββββ | βββββ | βββββ |
| tokei | ββββ | ββββ | β | ββ | ββββ |
| cloc | ββ | βββ | β | β | βββ |
| scc | ββββ | ββββ | β | ββ | ββββ |
βοΈ Configuration
HowMany supports persistent configuration through ~/.config/howmany/config.toml:
[]
= "interactive"
= "files"
= true
= true
[]
= true
= 8
= 100
[[]]
= ["*.tmp", "*.log", ".DS_Store"]
π§ͺ Development
Building from Source
Running Tests
# Run all tests
# Run with coverage
# Run benchmarks
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
π Use Cases
Development Teams
- Code Review: Understand codebase composition before reviews
- Technical Debt: Track documentation coverage and code quality
- Project Planning: Estimate development effort based on codebase size
DevOps & CI/CD
- Build Optimization: Identify large files affecting build times
- Quality Gates: Enforce minimum documentation standards
- Metrics Collection: Track codebase growth over time
Project Management
- Progress Tracking: Monitor development velocity
- Resource Planning: Understand team productivity
- Quality Assurance: Ensure consistent coding standards
π§ Integration Examples
GitHub Actions
- name: Analyze Codebase
run: |
cargo install howmany
howmany count --format json > codebase-stats.json
GitLab CI
analyze:
script:
- howmany count --verbose
- howmany count --format json > artifacts/stats.json
artifacts:
paths:
- artifacts/
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Built with Rust for performance and safety
- Rayon for parallel processing
- Clap for command-line parsing
- Indicatif for progress bars
- Comfy-table for beautiful tables
- Serde for serialization
- Ignore for gitignore support
π Star History
HowMany - Professional code analysis made beautiful and fast π¦β¨
"The fastest way to understand any codebase"