CodeDebt 🚀
Ultra-fast code debt detection library and CLI tool written in Rust.
Features
- Blazingly Fast: Parallel file scanning with Rust performance
- Smart Patterns: Detects TODO, FIXME, HACK, XXX, and more
- Severity Levels: Critical, High, Medium, Low classification
- Multiple Formats: Pretty, JSON, CSV output
- Library + CLI: Use as library or standalone tool
- Git-aware: Respects .gitignore automatically
- Enhanced Intelligence: Git blame integration, duplicate detection, file type analysis
- Advanced Filtering: Filter by age, duplicates, severity, and file types
Installation
Or build from source:
CLI Usage
Basic Usage
# Scan current directory
# Scan specific directory
# Show only critical and high severity
# Output as JSON
# Show summary only
# Custom file extensions
# Ignore additional directories
Enhanced Intelligence Features
# Enable git blame integration (shows author, age, commit info)
# Detect duplicate patterns across files
# Show file type distribution
# Show age distribution of code debt
# Filter by maximum age (requires git blame)
# Show only duplicates with minimum count
# Combine multiple intelligence features
Getting Help
# Get help
Library Usage
use ;
use Regex;
// Basic usage
let scanner = new;
let items = scanner.scan?;
// Enhanced intelligence features
let scanner = new
.with_git_blame // Enable git blame integration
.with_duplicate_detection // Enable duplicate detection
.with_file_extensions;
let all_items = scanner.scan?;
// Use enhanced methods
let summary = scanner.get_summary;
let file_types = scanner.get_file_type_summary;
let age_distribution = scanner.get_age_distribution;
// Apply filters
let recent_items = scanner.filter_by_age; // Last 30 days
let duplicates = scanner.find_duplicates; // 2+ occurrences
// Custom patterns
let custom_patterns = vec!;
let scanner = new.with_patterns;
Performance
- Lightning fast - scans large codebases in milliseconds
- Parallel processing of files using Rayon
- Memory efficient streaming with ignore crate
- Optimized regex compilation and matching
Example performance on codedebt project (57 items found in 3.6ms):
⚡ Scanned in 3.57ms
Patterns Detected
Pattern | Severity | Description |
---|---|---|
HACK, XXX | Critical | Code that needs immediate attention |
PRODUCTION_DEBT | Critical | Temporary/placeholder code in production context |
FIXME | High | Broken code that needs fixing |
TEMPORARY, PLACEHOLDER | High | Code not meant for production |
TODO | Medium | Future improvements |
NOTE.*fix | Medium | Notes about things that need fixing |
MOCK, STUB | Low | Test or development code |
Example Output
Basic Output
🔍 18 code debt items found:
🚨 CRITICAL PRODUCTION_DEBT ./src/config.rs:42:15 placeholder="Production API Key"
⚠️ HIGH TEMPORARY ./src/auth.rs:123:8 // Temporary workaround for OAuth
📝 MEDIUM TODO ./src/utils.rs:67:4 // TODO: Add proper error handling
💡 LOW MOCK_STUB ./tests/setup.rs:12:8 Mock database connection
⚡ Scanned in 5.17ms
Enhanced Intelligence Output
🔍 12 code debt items found:
🚨 CRITICAL HACK ./src/auth.rs:45:8 // HACK: bypass validation for demo
👤 john.doe@company.com • 📅 3 days ago • 🔄 2 duplicates
⚠️ HIGH FIXME ./src/utils.rs:123:4 // FIXME: memory leak in parser
👤 jane.smith@company.com • 📅 2 weeks ago
📝 MEDIUM TODO ./src/config.rs:67:4 // TODO: add environment validation
👤 bob.wilson@company.com • 📅 1 month ago • 🔄 5 duplicates
📊 File Type Distribution:
════════════════════════════════════════
rs 8
js 3
py 1
📅 Age Distribution:
════════════════════════════════════════
This week 2
This month 7
Last 3 months 3
⚡ Scanned in 8.42ms
Enhanced Intelligence Features
Git Blame Integration
- Author tracking: See who created each piece of code debt
- Age analysis: Understand how old technical debt is
- Commit context: Link debt to specific commits for deeper investigation
- Age filtering: Focus on recent or old debt with
--max-age
Duplicate Detection
- Pattern matching: Find repeated code debt across your codebase
- Count tracking: See how many times each pattern appears
- Duplicate filtering: Focus on the most common issues with
--min-duplicates
- Team awareness: Identify systemic problems affecting multiple files
File Type Analysis
- Language breakdown: See which programming languages have the most debt
- Technology debt: Understand debt distribution across your tech stack
- Targeting improvements: Focus refactoring efforts on the most problematic file types
Age Distribution
- Time-based insights: Understand debt accumulation patterns over time
- Project timeline: See how debt relates to project milestones
- Priority guidance: Focus on recent debt that's easier to fix or old debt that's become critical
Supported Languages
Rust, Python, JavaScript, TypeScript, Go, Java, C/C++, Ruby, PHP, C#, Swift, Kotlin, Scala, and more.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development
# Clone the repository
# Build and test
# Run on a sample project
License
MIT - see LICENSE file for details