Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

hotspots

Identify code hotspots — files with both high git churn and high structural complexity.

Synopsis

bobbin hotspots [OPTIONS]

Description

The hotspots command combines git commit history with AST-based complexity analysis to surface files that are both frequently changed and structurally complex. These files are the most likely sources of bugs and the best candidates for refactoring.

The hotspot score is the geometric mean of normalized churn and complexity:

score = sqrt(churn_normalized * complexity)

Where:

  • churn is the number of commits touching a file in the time window, normalized against the most-changed file.
  • complexity is a weighted AST complexity score in the range [0, 1].

Non-code files (markdown, JSON, YAML, TOML) and unknown file types are automatically excluded.

Options

OptionShortDefaultDescription
--path <DIR>.Directory to analyze
--since <EXPR>1 year agoTime window for churn analysis (git date expression)
--limit <N>-n20Maximum number of hotspots to show
--threshold <SCORE>0.0Minimum hotspot score (0.0–1.0)

Examples

Show top 20 hotspots from the last year:

bobbin hotspots

Narrow to the last 3 months, top 10:

bobbin hotspots --since "3 months ago" -n 10

Only show files with a score above 0.5:

bobbin hotspots --threshold 0.5

Verbose output includes a legend explaining the scoring:

bobbin hotspots --verbose

JSON output for CI or dashboards:

bobbin hotspots --json

JSON Output

{
  "count": 3,
  "since": "1 year ago",
  "hotspots": [
    {
      "file": "src/cli/hook.rs",
      "score": 0.823,
      "churn": 47,
      "complexity": 0.72,
      "language": "rust"
    }
  ]
}

Supported Languages

Complexity analysis supports: Rust, TypeScript/JavaScript, Python, Go, Java, C, C++.

Prerequisites

Requires a bobbin index and a git repository. Run bobbin init and bobbin index first.

See Also