A fast, intelligent code analysis tool for counting lines of code and analyzing project statistics.
HowMany is a command-line tool that analyzes codebases to provide comprehensive statistics about files, lines of code, complexity, and development time estimates. It automatically detects user-created code files while filtering out dependencies, build artifacts, and generated files.
Available integrations:
- CLI Tool: Direct command-line usage with interactive mode
- GitHub Actions: Automated analysis in CI/CD pipelines
- VS Code Extension: Real-time analysis directly in your editor
- Line Counting: Accurate counting of code lines, comments, documentation, and blank lines
- Enhanced Language Detection: Powered by Sherlock with 98%+ accuracy across 100+ programming languages and file types
- Complexity Analysis: Calculates cyclomatic complexity, cognitive complexity, and maintainability metrics
- Quality Metrics: Evaluates code health, documentation coverage, and maintainability scores
- Time Estimates: Provides development time estimates based on code volume and complexity
- Multiple Output Formats: Text, JSON, CSV, and HTML reports with interactive charts
- Interactive Mode: Terminal-based interface with charts, navigation, and search functionality
- Parallel Processing: Fast analysis using multi-threading and intelligent caching
- Smart Filtering: Automatically excludes dependencies, build artifacts, and generated files
brew install GriffinCanCode/howmany/howmanyhowmany is published from its own tap rather than homebrew-core, so the
package name is qualified. A bare brew install howmany will not find it.
cargo install howmanygit clone https://github.com/GriffinCanCode/howmany.git
cd howmany
cargo build --release./tools/rebuild.shThis will build the project and create a symlink in /usr/local/bin/howmany for system-wide access.
howmany initOne command, whichever way you installed. It finds the editors you actually
have, installs the VS Code extension for you, and points everything at the
binary you just installed. The first time you run howmany by hand it offers to
do this for you, so there is nothing to remember.
howmany 3.0.0
using /opt/homebrew/bin/howmany
VS Code
+ installed the GriffinCanCode.howmany extension
+ set howmany.binaryPath in ~/Library/Application Support/Code/User/settings.json
Neovim
+ wrote ~/.config/nvim/after/plugin/howmany.lua
Afterwards every file carries its own breakdown above the first line —
412 TypeScript · 305 code · 47 doc · 60 blank — recounted as you type, from
the unsaved buffer, by the same classifier that produces the report. Files that
cross a threshold get a warning in the problems panel.
--dry-run shows what would change without writing anything, --force
overwrites a setting you have pointed elsewhere, and --editor vscode,neovim
narrows it down. Nothing already set correctly is written twice.
The server is howmany lsp, which speaks LSP over stdin and stdout, so any
client can start it directly. Zed and Helix cannot register an arbitrary server
from their settings, so init does not pretend to configure them.
Thresholds live in howmany.toml next to the rest of the configuration:
[lsp]
code_lens = true # the breakdown above each file
max_file_lines = 800 # warn past this; 0 never warns
min_doc_ratio = 0.05 # documentation as a share of code; 0 never warns
documented_from_lines = 200 # never call a file smaller than this undocumentedHowMany can be integrated directly into your GitHub workflows using the official GitHub Action:
name: Code Analysis
on: [push, pull_request]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: GriffinCanCode/howmany-actions@v1
with:
path: '.'
create-pr-comment: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}name: Quality Gate
on: [pull_request]
jobs:
quality-check:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Quality Gate Check
uses: GriffinCanCode/howmany-actions@v1
with:
fail-on-quality-gate: true
quality-threshold: 80
maintainability-threshold: 70
documentation-threshold: 25
create-pr-comment: true- Automated Analysis: Runs HowMany analysis on every push/PR
- Quality Gates: Fail builds based on configurable quality thresholds
- PR Comments: Automatic pull request comments with detailed results
- Multiple Formats: JSON, HTML, and SARIF output support
- SARIF Integration: Native GitHub Code Scanning support
- Zero Configuration: Works out of the box with sensible defaults
For detailed configuration options and advanced usage, see the HowMany GitHub Action documentation.
HowMany has a dedicated VS Code extension that brings code analysis directly into your editor:
# `howmany init` does this for you; this is the manual equivalent
code --install-extension GriffinCanCode.howmanyFeatures:
- Live Line Counts: Each file's breakdown above its first line, recounted as you type
- Smart Status Bar: Live metrics display with quality color-coding
- Interactive Reports: Detailed analysis with complexity metrics and quality scores
- Command Integration: Full command palette and context menu support
- Export Options: Generate reports in JSON, HTML, and CSV formats
- Real-time Analysis: Instant feedback without leaving your editor
Quick Start:
- Install HowMany CLI (using any method above)
- Run
howmany init, which installs the extension and points it at the binary - Open a project and click the HowMany status bar item
- View detailed reports and quality metrics
For more information, visit the HowMany VS Code Extension repository.
# Analyze current directory (interactive mode by default)
howmany
# Analyze specific directory
howmany /path/to/project
# Non-interactive text output
howmany --no-interactive
# Show individual file statistics
howmany --files
# Verbose output with detailed breakdown
howmany --verbose# Generate HTML report with interactive charts
howmany --output html
# Export to JSON
howmany --output json
# Export to CSV
howmany --output csv
# Plain text output
howmany --output text# Analyze only specific file extensions
howmany --ext rs,py,js
# Set maximum directory depth
howmany --depth 3
# Include hidden files
howmany --hidden
# Add custom ignore patterns
howmany --ignore node_modules,target,dist
# List files that would be analyzed
howmany --list# Sort by different criteria
howmany --sort lines --desc
howmany --sort code
howmany --sort files
howmany --sort comments
howmany --sort sizeHowMany automatically detects and analyzes these languages using Sherlock, our fast and accurate language detection tool that intelligently filters out dependencies, build artifacts, and cache files:
Systems & Performance:
- Rust, C/C++, Zig, Go
Object-Oriented:
- Java, Kotlin, C#, Swift, Scala
Scripting & Dynamic:
- Python, JavaScript, TypeScript, Ruby, PHP, Perl, Lua
Functional & Academic:
- Haskell, Clojure, Elixir, Erlang, Julia, R, MATLAB
Mobile & Cross-Platform:
- Dart (Flutter), Swift (iOS), Kotlin (Android)
- HTML, CSS, SCSS, Sass, Less
- Vue, Svelte, React (JSX/TSX)
- Template engines (Twig, Handlebars, etc.)
- JSON, XML, YAML, TOML
- Markdown, reStructuredText
- Shell scripts (bash, zsh, fish)
- PowerShell, Batch files
Rust ████████████████████████████████████████ 45.2%
JavaScript ████████████████████████████ 32.1%
Python ████████████████ 18.7%
TypeScript ████ 4.0%
Example distribution from a typical multi-language project
The Maintainability Index is an industry-standard metric that predicts code maintainability:
- 85-100: Excellent maintainability
- 65-84: Good maintainability
- 20-64: Moderate maintainability (refactoring recommended)
- 0-19: Poor maintainability (consider rewriting)
- Cyclomatic Complexity: Measures decision points and code paths
- Cognitive Complexity: Measures mental effort required to understand code
- Nesting Depth: Tracks maximum indentation levels
- Function Length: Analyzes average and maximum function sizes
- Overall Quality Score: Weighted combination of all metrics (0-100)
- Documentation Coverage: Percentage of code with comments/docs
- Readability Score: Based on comment density and structure
- Technical Debt Ratio: Estimated maintenance burden
The default interactive mode provides:
- Overview Tab: Summary statistics with animated charts
- Languages Tab: Breakdown by programming language with health metrics
- Export Tab: Export results to various formats
Tab/Shift+Tab: Switch between tabs1,2,3: Jump to specific tabs↑/↓orj/k: Navigate lists and tables/ors: Toggle search modet: Toggle code health view (in Languages tab)horF1: Show helpqorEsc: Quit
- Files: Search by file name and path
- Extensions: Search by file extension
- Content: Search by estimated content/keywords
Tab: Cycle between search modesEnter: Jump to selected result
=== Code Statistics ===
Total files: 127
Total lines: 15,847
Code lines: 11,234
Comment lines: 2,156
Documentation lines: 1,247
Blank lines: 1,210
Total size: 567,890 bytes (554.6 KB)
=== Complexity Analysis ===
Functions: 342
Average complexity: 3.8
Max nesting depth: 5
Maintainability index: 78.2
=== Quality Metrics ===
Overall quality score: 82.4/100
Documentation score: 75.1/100
Maintainability score: 78.2/100
=== Time Estimates ===
Total development time: 3 days, 2 hours
Code writing time: 2 days, 1 hour
Documentation time: 6 hours
- Interactive Charts: Language distribution, complexity analysis, quality metrics
- Responsive Design: Works on desktop and mobile
- Quality Insights: Color-coded health indicators and recommendations
- Detailed Breakdowns: File-by-file analysis with complexity details
- Export Options: Built-in export functionality
| Option | Short | Description |
|---|---|---|
--output |
-o |
Output format: text, json, csv, html |
--files |
-f |
Show individual file statistics |
--verbose |
-v |
Show detailed breakdown by extension |
--no-interactive |
Disable interactive mode (force text output) | |
--depth |
-d |
Maximum directory depth to traverse |
--ext |
-e |
Only count specific extensions (comma-separated) |
--hidden |
Include hidden files and directories | |
--sort |
-s |
Sort by: files, lines, code, comments, size |
--desc |
Sort in descending order | |
--ignore |
Additional ignore patterns (comma-separated) | |
--list |
-l |
List files that would be counted (dry run) |
HowMany automatically excludes:
node_modules/,target/,__pycache__/,site-packages/vendor/,deps/,build/,dist/,.next/
*.o,*.class,*.pyc,*.pyo,*.obj,*.exe.cache/,.tmp/,temp/,.serverless/
.git/,.svn/,.hg/,.bzr/.vscode/,.idea/,.vs/,.DS_Store
*.generated.*,*.min.js,*.bundle.**.log,*.tmp,coverage/,reports/
- Parallel Processing: Utilizes all available CPU cores
- Smart Caching: Caches results for faster subsequent runs with 85%+ hit rates
- Memory Efficient: Processes files in chunks, handles large codebases
- Fast Analysis: Typically processes 10,000+ files in under 5 seconds
Create ~/.config/howmany/config.toml for custom settings:
[defaults]
output_format = "interactive"
show_progress = true
use_colors = true
interactive_by_default = true
[performance]
parallel_processing = true
cache_enabled = true
chunk_size = 100
[filtering]
respect_gitignore = true
include_hidden = false
max_depth = 50
[quality_thresholds]
excellent_maintainability = 85.0
good_maintainability = 65.0
min_doc_coverage = 20.0
[custom_patterns]
ignore = ["*.tmp", "*.log", "node_modules/"]
include_extensions = [] # Empty means all supportedhowmany ~/my-rust-project --ext rs,toml --verbosehowmany ~/my-project --output html --fileshowmany --no-interactive --verbose | grep -A 10 "Quality Metrics"howmany --ext md,rst,txt --sort lines --desc# Large codebase analysis with caching
howmany /path/to/large/project --depth 10 --verbose- Intelligent file change detection using timestamps and checksums
- Persistent cache across runs for improved performance
- Automatic cache cleanup and optimization
- Detects language-specific patterns (imports, exports, classes, functions)
- Calculates complexity based on language characteristics
- Provides language-specific quality recommendations
- Based on industry-standard development velocity metrics
- Accounts for code complexity and documentation density
- Separates coding time from documentation time
MIT License. See LICENSE for details.
Contributions are welcome! Please feel free to submit pull requests or open issues.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Current version: 3.0.0

