### Verify installation Source: https://iepathos.github.io/debtmap/getting-started.html Check the installed version and view available commands. ```bash # Check version debtmap --version # See available commands debtmap --help ``` -------------------------------- ### Install Debtmap and verify Source: https://iepathos.github.io/debtmap/prodigy-integration.html Installs Debtmap using cargo and verifies the installation with `debtmap --version`. ```bash # Install Debtmap cargo install debtmap # Verify installation debtmap --version ``` -------------------------------- ### Install via wget Source: https://iepathos.github.io/debtmap/getting-started.html Download and install the latest release using wget. ```bash wget -qO- https://raw.githubusercontent.com/iepathos/debtmap/master/install.sh | bash ``` -------------------------------- ### Comprehensive .debtmap.toml example Source: https://iepathos.github.io/debtmap/examples.html A full configuration example covering thresholds, entropy, scoring, language support, ignore patterns, and god object settings. ```toml [thresholds] complexity = 12 duplication = 30 max_file_lines = 400 max_function_lines = 40 minimum_debt_score = 1.0 minimum_cyclomatic_complexity = 2 [entropy] enabled = true weight = 0.5 [scoring] coverage = 0.40 complexity = 0.40 dependency = 0.20 [languages] enabled = ["rust", "python", "javascript", "typescript"] [ignore] patterns = [ # Tests "tests/**/*", "**/*.test.*", "**/*_test.*", # Build artifacts "target/**", "dist/**", "build/**", "node_modules/**", # Python ".venv/**", "**/__pycache__/**", # Generated code "*.generated.*", "*.pb.*", ] [god_object] enabled = true max_methods = 18 max_fields = 12 ``` -------------------------------- ### Install Prodigy from GitHub and verify Source: https://iepathos.github.io/debtmap/prodigy-integration.html Installs Prodigy from the GitHub repository using cargo and verifies the installation with `prodigy --version`. Requires Rust 1.70 or later and Git. ```bash # Install Prodigy from GitHub repository cargo install --git https://github.com/iepathos/prodigy prodigy # Verify installation prodigy --version ``` -------------------------------- ### Examples: debtmap explain-coverage Source: https://iepathos.github.io/debtmap/cli-reference.html Three examples: basic coverage explanation, narrowing search with verbose output, and JSON output for automation. ```bash # Explain coverage for a specific function debtmap explain-coverage src/ --coverage-file coverage.lcov --function "process_file" ``` ```bash # Narrow search to specific file with verbose output debtmap explain-coverage . --lcov lcov.info --function "analyze_complexity" --file "src/analyzer.rs" -v ``` ```bash # JSON output for automation debtmap explain-coverage . --coverage-file coverage.lcov --function "my_function" --format json ``` -------------------------------- ### Install and verify Prodigy Source: https://iepathos.github.io/debtmap/prodigy-integration.html Install Prodigy, set the ANTHROPIC_API_KEY environment variable, and verify the installation with the version command. ```bash cargo install prodigy ``` ```bash export ANTHROPIC_API_KEY="your-key" ``` ```bash prodigy --version ``` -------------------------------- ### Install via curl Source: https://iepathos.github.io/debtmap/getting-started.html Download and install the latest release using curl. ```bash curl -sSL https://raw.githubusercontent.com/iepathos/debtmap/master/install.sh | bash ``` -------------------------------- ### Complete Scoring Configuration Example Source: https://iepathos.github.io/debtmap/configuration/scoring.html A comprehensive example showing both coverage weight adjustments and role multiplier clamping configured together. ```toml # Stage 1: Coverage weight adjustments [scoring.role_coverage_weights] pure_logic = 1.0 # Pure logic should have unit tests (default: 1.0) entry_point = 0.6 # Reduce penalty for integration-tested entry points orchestrator = 0.8 # Partially reduce penalty for orchestrators io_wrapper = 0.5 # I/O wrappers are integration tested (default: 0.5) pattern_match = 1.0 # Standard debug = 0.3 # Debug functions have lowest coverage expectations (default: 0.3) unknown = 1.0 # Standard # Stage 2: Role multiplier with clamping [scoring.role_multiplier] clamp_min = 0.3 # I/O wrappers contribute at least 30% clamp_max = 1.8 # Critical functions get at most 180% enable_clamping = true # Keep clamping enabled for stability ``` -------------------------------- ### Display Configuration Example Source: https://iepathos.github.io/debtmap/configuration/display-output.html Example of the [display] section in a TOML configuration file, showing default settings for tiered display, items per tier, and verbosity. ```toml [display] # Use tiered priority display for organizing results tiered = true # Maximum items to show per tier items_per_tier = 5 # Verbosity level (summary, detailed, comprehensive) verbosity = "detailed" ``` -------------------------------- ### CI workflow: install, build, coverage, validate Source: https://iepathos.github.io/debtmap/examples.html CI workflow steps: install cargo-tarpaulin, build debtmap, generate coverage, and run validation with coverage output. ```bash # 1. Install cargo-tarpaulin cargo install cargo-tarpaulin # 2. Build debtmap cargo build --release # 3. Generate coverage cargo tarpaulin --config .tarpaulin.toml --out Lcov --timeout 300 # 4. Run validation with coverage ./target/release/debtmap validate . \ --coverage-file target/coverage/lcov.info \ --format json \ --output debtmap-report.json ``` -------------------------------- ### Create configuration file from example Source: https://iepathos.github.io/debtmap/troubleshooting/error-messages.html Command to initialize a configuration file if the expected file is missing. ```bash cp .debtmap.toml.example .debtmap.toml ``` -------------------------------- ### debtmap diagnose-coverage examples Source: https://iepathos.github.io/debtmap/cli-reference.html Two examples: validating a coverage file with text output and getting JSON output for automation. ```bash # Validate coverage file with text output debtmap diagnose-coverage coverage.lcov # Get JSON output for automation debtmap diagnose-coverage lcov.info --format json ``` -------------------------------- ### Annotated JSON output example (pre-v3, deprecated) Source: https://iepathos.github.io/debtmap/output-formats.html Complete annotated JSON output example for the removed pre-v3 output. Retained temporarily only to explain older reports; do not use these paths for new integrations. Use the v4 schema and guide linked above. ```json { // Project metadata "project_path": "/Users/dev/myproject", "timestamp": "2025-01-09T15:30:00Z", // Complexity analysis results "complexity": { "metrics": [ { "name": "calculate_risk_score", "file": "src/risk/scoring.rs", "line": 142, "cyclomatic": 12, "cognitive": 18, "nesting": 4, "length": 85, "is_test": false, "visibility": "pub", "is_trait_method": false, "in_test_module": false, "entropy_score": { "token_entropy": 0.65, "pattern_repetition": 0.30, "branch_similarity": 0.45, "effective_complexity": 0.85 }, "is_pure": false, "purity_confidence": 0.75, "detected_patterns": ["nested_loops", "complex_conditionals"], "upstream_callers": ["analyze_codebase", "generate_report"], "downstream_callees": ["get_metrics", "apply_weights"] } ], "summary": { "total_functions": 287, "average_complexity": 6.3, "max_complexity": 24, "high_complexity_count": 12 } }, // Technical debt items "technical_debt": { "items": [ { "id": "debt_001", "debt_type": "Complexity", "priority": "High", "file": "src/analyzers/rust.rs", "line": 245, "column": 5, "message": "High cyclomatic complexity: 18", "context": "Function parse_function has excessive branching" }, { "id": "debt_002", "debt_type": "Todo", "priority": "Medium", "file": "src/core/cache.rs", "line": 89, "column": null, "message": "TODO: Implement LRU eviction policy", "context": null } ], "by_type": { "Complexity": [ /* same structure as items */ ], "Todo": [ /* ... */ ], "Duplication": [ /* ... */ ] }, "priorities": ["Low", "Medium", "High", "Critical"] }, // Dependency analysis "dependencies": { "modules": [ { "module": "risk::scoring", "dependencies": ["core::metrics", "debt::patterns"], "dependents": ["commands::analyze", "io::output"] } ], "circular": [ { "cycle": ["module_a", "module_b", "module_c", "module_a"] } ] }, // Code duplication blocks "duplications": [ { "hash": "abc123def456", "lines": 15, "locations": [ { "file": "src/parser/rust.rs", "start_line": 42, "end_line": 57 }, { "file": "src/parser/python.rs", "start_line": 89, "end_line": 104 } ] } ] } ``` -------------------------------- ### Build and install from source Source: https://iepathos.github.io/debtmap/getting-started.html Clone the repository and build the development version locally. ```bash # Clone the repository git clone https://github.com/iepathos/debtmap.git cd debtmap # Build and install cargo install --path . ``` -------------------------------- ### Example with all options Source: https://iepathos.github.io/debtmap/dashboard Shows the debtmap analyze command with all recommended flags: --format json, -o, --lcov, and --context. ```bash debtmap analyze . \ --format json \ -o debtmap.json \ --lcov target/coverage/lcov.info \ --context ``` -------------------------------- ### GitHub Actions Workflow for Debtmap Source: https://iepathos.github.io/debtmap/configuration/best-practices.html Example workflow for GitHub Actions that installs Debtmap, generates coverage data, runs validation, and uploads the resulting report as an artifact. ```yaml name: Technical Debt Validation on: push: branches: [main, master] pull_request: branches: [main, master] jobs: validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Debtmap run: cargo install debtmap - name: Generate coverage data run: | cargo install cargo-llvm-cov cargo llvm-cov --lcov --output-path coverage.lcov - name: Run Debtmap validation run: | debtmap validate . \ --coverage-file coverage.lcov \ --format json \ --output debtmap-report.json - name: Upload report if: always() uses: actions/upload-artifact@v4 with: name: debtmap-report path: debtmap-report.json ``` -------------------------------- ### New Project (Empty Before) example output Source: https://iepathos.github.io/debtmap/compare-analysis.html Example comparison output for a new project or first analysis: new_critical_count 15, resolved_count 0, overall_debt_trend Stable, and before project health shows zero items. Establishes a baseline for future comparisons. ```json { "summary": { "new_critical_count": 15, "resolved_count": 0, "overall_debt_trend": "Stable" }, "project_health": { "before": { "total_items": 0 } } } ``` -------------------------------- ### With Context Providers Output Source: https://iepathos.github.io/debtmap/context-providers.html Example output with context providers, showing elevated score for entry point and reduced for utility. ```text Function: main() - Entry point Complexity: 8 Coverage: 50% Base Score: 6.0 Role Multiplier: 1.5x (entry point) Final Score: 9.0 [CRITICAL] Function: format_string() - Utility Complexity: 8 Coverage: 50% Base Score: 6.0 Role Multiplier: 0.5x (utility) Final Score: 3.0 [LOW] ``` -------------------------------- ### Install Pytest Coverage Plugin Source: https://iepathos.github.io/debtmap/coverage-integration.html Install the pytest-cov plugin for Python. ```bash pip install pytest-cov ``` -------------------------------- ### Run analysis with context providers Source: https://iepathos.github.io/debtmap/context-providers.html Examples for running full analysis with specific providers or fast analysis without context. ```bash # Full analysis with context (run nightly) debtmap analyze . --context-providers critical_path,dependency,git_history # Fast analysis without context (run on every commit) debtmap analyze . --no-context-aware ``` -------------------------------- ### Install Cargo Tarpaulin Source: https://iepathos.github.io/debtmap/coverage-integration.html Install the cargo-tarpaulin tool for Rust coverage. ```bash cargo install cargo-tarpaulin ``` -------------------------------- ### Local development setup Source: https://iepathos.github.io/debtmap/dashboard Commands to serve the dashboard locally for development. Run from the viz-dev directory and open the provided URL. ```bash cd viz-dev ./serve.sh # Open http://localhost:8080/viz-dev/dashboard.html ``` -------------------------------- ### Example Calculation: Low Repetition Source: https://iepathos.github.io/debtmap/entropy-analysis.html Calculation example where no reduction is applied. ```text __ Raw Complexity: 20 Pattern Repetition: 0.2 (low - not repetitive) Token Entropy: 0.8 (high variety) Branch Similarity: 0.3 (diverse branches) repetition_factor ≈ 1.0 (no reduction) entropy_factor ≈ 1.0 (no reduction) branch_factor ≈ 1.0 (no reduction) dampening_factor = (1.0 × 1.0 × 1.0) = 1.0 Effective Complexity = 20 × 1.0 = 20 Result: 0% reduction (complexity preserved) ``` -------------------------------- ### Memory estimate example (50 files, 8 threads) Source: https://iepathos.github.io/debtmap/parallel-processing.html Example calculation for 50 files averaging 10 KB each with 8 threads. The result is negligible, but for very large files (>1 MB) consider reducing the thread count. ```text Memory ≈ 8 × 10 KB × 3 = 240 KB (negligible) ``` -------------------------------- ### Init Command Usage Source: https://iepathos.github.io/debtmap/cli-reference.html Initializes a new .debtmap.toml configuration file in the current directory. ```bash debtmap init [OPTIONS] ``` -------------------------------- ### Install gcov2lcov Source: https://iepathos.github.io/debtmap/coverage-integration.html Install the gcov2lcov tool to convert Go coverage profiles. ```bash go install github.com/jandelgado/gcov2lcov@latest ``` -------------------------------- ### Implementation plan file for compare Source: https://iepathos.github.io/debtmap/compare-analysis.html Create an IMPLEMENTATION_PLAN.md file with a target location section to specify the code location to track. The plan includes the location, current debt score, severity, problem analysis, and proposed solution. ```markdown # Implementation Plan ## Target Item **Location**: ./src/example.rs:complex_function:45 **Current Debt Score**: 85.5 **Severity**: critical ## Problem Analysis The `complex_function` has high cognitive complexity... ## Proposed Solution 1. Extract nested conditionals into separate functions 2. Use early returns to reduce nesting depth 3. Add comprehensive unit tests ``` -------------------------------- ### Example Calculation: High Repetition Source: https://iepathos.github.io/debtmap/entropy-analysis.html Calculation example where the complexity floor is applied. ```text __ Raw Complexity: 20 Pattern Repetition: 0.95 (very high) Token Entropy: 0.3 (low variety) Branch Similarity: 0.9 (very similar branches) repetition_factor ≈ 0.85 (15% reduction) entropy_factor ≈ 0.90 (10% reduction) branch_factor ≈ 0.80 (20% reduction) dampening_factor = (0.85 × 0.90 × 0.80) = 0.612 dampening_factor = max(0.612, 0.7) = 0.7 // Floor applied Effective Complexity = 20 × 0.7 = 14 Result: 30% reduction (maximum allowed) ``` -------------------------------- ### Install via cargo Source: https://iepathos.github.io/debtmap/getting-started.html Install Debtmap using the Rust cargo package manager. ```bash cargo install debtmap ``` -------------------------------- ### Example .debtmap.toml configuration Source: https://iepathos.github.io/debtmap/troubleshooting/error-messages.html A valid configuration file structure defining thresholds and scoring parameters. ```toml # .debtmap.toml [thresholds] complexity = 10 max_file_length = 500 [scoring] coverage = 0.40 complexity = 0.30 ``` -------------------------------- ### Escape Analysis Report Example Source: https://iepathos.github.io/debtmap/output-formats.html Example of the escape analysis section in markdown reports. ```markdown - Escape Analysis: 2 variables escape - Return dependencies: result, accumulator - **Insight**: These variables directly affect function output ``` -------------------------------- ### I/O Operations Report Example Source: https://iepathos.github.io/debtmap/output-formats.html Example of the I/O operations section in markdown reports. ```markdown - I/O Operations: 3 detected - File Read at line 105 - Network Call at line 110 - Database Query at line 120 - **Recommendation**: Consider isolating I/O in separate functions ``` -------------------------------- ### Bidirectional Dependency Implementation Example Source: https://iepathos.github.io/debtmap/architectural-analysis.html An example of bidirectional dependency between order.rs and customer.rs modules. ```rust #![allow(unused)] fn main() { // order.rs use crate::customer::Customer; pub struct Order { customer: Customer, } // customer.rs use crate::order::Order; // Bidirectional dependency! pub struct Customer { orders: Vec, } } ``` -------------------------------- ### Entropy-adjusted output example Source: https://iepathos.github.io/debtmap/examples.html Example output showing dampened complexity due to repetitive patterns. ```text #15 SCORE: 68.2 [HIGH] ├─ COMPLEXITY: cyclomatic=20 (dampened: 14, factor: 0.70), est_branches=40, cognitive=25, nesting=3, entropy=0.30 - Entropy Impact: 30% dampening (entropy: 0.30, repetition: 95%) ``` -------------------------------- ### Tiered Display Configuration Source: https://iepathos.github.io/debtmap/configuration/display-output.html Example showing how to enable tiered display and set items per tier to 10, which limits output to 10 items per priority tier. ```toml [display] tiered = true items_per_tier = 10 # Show up to 10 items per tier ``` -------------------------------- ### Unified Output JSON Example Source: https://iepathos.github.io/debtmap/analysis-guide/example-outputs.html Example of the unified output format with summary statistics at the top level. Includes metadata, summary fields like debt_density, by_type, by_category, and score_distribution. The items array is empty in this example. ```json { "format_version": "3.0", "metadata": { "debtmap_version": "0.16.5", "generated_at": "2026-05-18T22:15:00Z", "project_root": "/home/user/myproject", "analysis_type": "unified" }, "summary": { "total_items": 127, "total_debt_score": 2845.6, "debt_density": 0.18, "total_loc": 15823, "by_type": { "File": 8, "Function": 119 }, "by_category": { "CodeQuality": 67, "Architecture": 12, "Testing": 42, "Performance": 6 }, "score_distribution": { "critical": 15, "high": 34, "medium": 58, "low": 20 } }, "items": [] } ``` -------------------------------- ### Example output for DEBTMAP_COVERAGE_DEBUG Source: https://iepathos.github.io/debtmap/troubleshooting/debug-mode.html Sample output showing coverage matching statistics: total functions, functions with/without coverage, and match strategy breakdown. ```text === Coverage Matching Statistics === Total functions analyzed: 150 Functions with coverage: 123 (82.0%) Functions without coverage: 27 (18.0%) Match Strategy Breakdown: exact_match: 95 (77.2%) suffix_match: 20 (16.3%) method_name_match: 8 (6.5%) ``` -------------------------------- ### debtmap validate-improvement examples Source: https://iepathos.github.io/debtmap/cli-reference.html Two examples: basic validation and validation with trend tracking and custom threshold. ```bash # Basic validation debtmap validate-improvement --comparison comparison.json # With trend tracking and custom threshold debtmap validate-improvement \ --comparison .prodigy/comparison.json \ --previous-validation .prodigy/validation.json \ --output .prodigy/validation.json \ --threshold 80.0 ``` -------------------------------- ### Context provider example workflows Source: https://iepathos.github.io/debtmap/examples.html Example workflows for using context providers: find volatile high-complexity code with git_history, understand refactoring impact with dependency, and disable a slow provider with --disable-context. ```bash # Find volatile high-complexity code debtmap analyze . --context --context-providers git_history # Understand refactoring impact debtmap analyze . --context --context-providers dependency # Disable slow provider for faster analysis debtmap analyze . --context --disable-context git_history ``` -------------------------------- ### Risk Score Calculation Example Source: https://iepathos.github.io/debtmap/architecture.html A conceptual example demonstrating how the risk score is calculated for a specific function. ```rust #![allow(unused)] fn main() { fn calculate_risk_score(): Effective Complexity: 8.5 Coverage: 30% Coverage Gap Weight: 0.7 Call Graph Depth: 3 Untested Paths: 2 Priority = ((8.5 * 10.0) + dependency impact) * coverage dampening } ``` -------------------------------- ### Compare using implementation plan Source: https://iepathos.github.io/debtmap/examples.html Automatically extract the target location from an implementation plan file. ```bash # If IMPLEMENTATION_PLAN.md contains: # **Target**: src/parser.rs:parse_expression:45 debtmap compare \ --before before.json \ --after after.json \ --plan IMPLEMENTATION_PLAN.md ``` -------------------------------- ### Mutation Analysis Report Example Source: https://iepathos.github.io/debtmap/output-formats.html Example of the mutation analysis section included in markdown reports when verbosity is enabled. ```markdown **Data Flow Analysis** - Mutations: 10 total, 2 live, 2 dead stores - **Opportunity**: Remove 2 dead store(s) to simplify code - **Almost Pure**: Only 2 live mutation(s), consider extracting pure subset ``` -------------------------------- ### Advanced Unified Scoring Examples Source: https://iepathos.github.io/debtmap/analysis-guide/interpreting-results.html Examples for filtering high-impact items and setting specific thresholds for critical items. ```bash # Show top 20 critical items debtmap analyze . --min-priority critical --top 20 # Focus on high-impact items (score >= 50) debtmap analyze . --format json | jq '.items[] | select(.score >= 50)' ``` -------------------------------- ### Quick overview and deep dive with coverage Source: https://iepathos.github.io/debtmap/why-debtmap.html Use `debtmap analyze` with `--top 10` for a quick overview, and with `--lcov` and `-vv` for a detailed terminal output. ```bash # Quick overview debtmap analyze . --top 10 # Deep dive with coverage debtmap analyze . --lcov coverage.lcov --format terminal -vv ``` -------------------------------- ### Effective Complexity Calculation Example Source: https://iepathos.github.io/debtmap/architecture.html An example showing how repetitive code patterns reduce the effective complexity score. ```rust #![allow(unused)] fn main() { // 20 similar if/return statements // Cyclomatic: 20, Entropy: 0.3 // Effective: 20 * (1 - (1 - 0.3/4.32) * 0.75) ≈ 5.5 } ``` -------------------------------- ### Compare output formats Source: https://iepathos.github.io/debtmap/examples.html Examples of different output formats including JSON, terminal, and Markdown. ```bash # JSON output (default) debtmap compare --before before.json --after after.json # Terminal output (explicit) debtmap compare \ --before before.json \ --after after.json \ --format terminal # JSON for CI integration (explicit output file) debtmap compare \ --before before.json \ --after after.json \ --format json \ --output comparison.json # Markdown report debtmap compare \ --before before.json \ --after after.json \ --format markdown \ --output COMPARISON.md ``` -------------------------------- ### Pure Function Example Source: https://iepathos.github.io/debtmap/functional-analysis.html A pure function example that performs only computation without mutations, I/O, or global state changes. ```rust __ #![allow(unused)] fn main() { // Pure - only computation fn fibonacci(n: u32) -> u32 { match n { 0 => 0, 1 => 1, _ => fibonacci(n - 1) + fibonacci(n - 2), } } } ``` -------------------------------- ### Recommended Splits Output for UserManager Source: https://iepathos.github.io/debtmap/responsibility-analysis.html Example output generated by recommend_module_splits() showing suggested module names, method counts, and estimated lines of code. ```text Recommended Splits for UserManager: 1. DataAccessManager (5 methods, ~80 lines) - get_user, set_password, get_email, set_email, update_profile 2. ValidationManager (4 methods, ~60 lines) - validate_email, validate_password, check_permissions, verify_token 3. PersistenceManager (3 methods, ~50 lines) - save_user, load_user, delete_user 4. NotificationManager (2 methods, ~30 lines) - send_notification, send_bulk_notifications ``` -------------------------------- ### Analyze Go Project with Debtmap Source: https://iepathos.github.io/debtmap/coverage-integration.html Run the Debtmap analysis on a Go project. ```bash debtmap analyze . --lcov coverage.lcov --languages go ``` -------------------------------- ### Impure function examples Source: https://iepathos.github.io/debtmap/functional-analysis.html Examples of impure functions with side effects: mutable references, I/O operations, and mutation of collections. ```rust #![allow(unused)] fn main() { // Impure - mutable reference fn increment(value: &mut i32) { *value += 1; } // Impure - I/O operation fn log_value(value: i32) { println!("Value: {}", value); } // Impure - mutation fn process_items(items: &mut Vec) { items.push(42); } } ``` -------------------------------- ### Global CLI Options Source: https://iepathos.github.io/debtmap/cli-reference.html Examples of using global flags to inspect configuration sources or specify custom configuration files. ```bash debtmap --show-config-sources analyze . debtmap --config /path/to/debtmap.toml validate . ``` -------------------------------- ### Level 2 (-vv) output example Source: https://iepathos.github.io/debtmap/output-formats.html Example output with -vv flag, adding detailed calculations with formulas and intermediate values. ```text Total debt score: 156 (threshold: 100) Complexity contribution: 85 (54%) Formula: sum(cyclomatic_weight * severity_multiplier) High complexity functions: 5 × 12 = 60 Medium complexity: 8 × 3 = 24 Base penalty: 1 Coverage gaps: 45 (29%) Uncovered complex functions: 3 × 15 = 45 ``` -------------------------------- ### Initialize and validate configuration Source: https://iepathos.github.io/debtmap/cli-reference.html Commands for managing the Debtmap configuration file. ```bash # Initialize config debtmap init --force # Validate against config debtmap validate . --config debtmap.toml # With max debt density threshold debtmap validate . --max-debt-density 50 ``` -------------------------------- ### Benign Side Effect Example Source: https://iepathos.github.io/debtmap/functional-analysis.html An example of a benign side effect using logging, which receives a small penalty in purity scoring. ```rust __ #![allow(unused)] fn main() { use tracing::debug; // Benign - logging side effect fn process(value: i32) -> i32 { debug!("Processing value: {}", value); value * 2 } } ``` -------------------------------- ### Probably pure function examples Source: https://iepathos.github.io/debtmap/functional-analysis.html Examples of probably pure functions: static functions and associated functions with no obvious side effects. ```rust #![allow(unused)] fn main() { // Probably pure - static function fn transform(value: i32) -> i32 { value * 2 } // Probably pure - associated function impl MyType { fn create_default() -> Self { MyType { value: 0 } } } } ``` -------------------------------- ### Example output for DEBTMAP_TIMING Source: https://iepathos.github.io/debtmap/troubleshooting/debug-mode.html Sample output showing per-file timing breakdown: total time and components (analysis, debt, deps). ```text [TIMING] analyze_rust_file src/main.rs: total=0.45s (analysis=0.32s, debt=0.08s, deps=0.05s) [TIMING] analyze_rust_file src/lib.rs: total=0.12s (analysis=0.09s, debt=0.02s, deps=0.01s) ``` -------------------------------- ### Example impact configurations for role coverage weights Source: https://iepathos.github.io/debtmap/configuration/scoring.html Two example configurations showing how to emphasize pure logic testing or use a conservative approach. The first sets higher penalties for untested pure logic and lower penalties for entry points and I/O wrappers. The second uses smaller adjustments. ```toml # Emphasize pure logic testing strongly [scoring.role_coverage_weights] pure_logic = 1.5 # 50% higher penalty for untested logic entry_point = 0.5 # 50% lower penalty for untested entry points io_wrapper = 0.4 # 60% lower penalty for untested I/O # Conservative approach (smaller adjustments) [scoring.role_coverage_weights] pure_logic = 1.1 # Only 10% increase entry_point = 0.9 # Only 10% decrease ``` -------------------------------- ### Use quality-focused preset Source: https://iepathos.github.io/debtmap/scoring-strategies/rebalanced.html Creates a configuration file for the quality-focused preset and runs `debtmap analyze` with that config, showing the top 10 results. ```bash # Quality-focused preset cat > .debtmap-quality.toml <