Skip to content

Complexity Heatmap

The complexity heatmap visualizes extraction difficulty across modules. Hotter regions indicate higher complexity, more coupling, and greater risk during extraction.

The heatmap renders data from complexity.json using ERPNext as the reference dataset:

  • Color intensity reflects lines of code and cyclomatic complexity
  • Cell size corresponds to function count
  • Labels show file paths and key metrics
  • Tier indicators mark Extract Now (green), Extract With Care (yellow), and Defer (red)

The top complexity hotspots from the ERPNext reference dataset:

FileLinesFunctionsTier
controllers/accounts_controller.py4,412168Defer (decompose first)
stock/doctype/stock_entry/stock_entry.py4,149120Defer
accounts/doctype/payment_entry/payment_entry.py3,55995Extract With Care
accounts/doctype/sales_invoice/sales_invoice.py3,16785Extract With Care
stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py3,28590Defer
ColorTierAction
GreenTier 1: Extract NowLow complexity, clear boundaries. Extract immediately.
YellowTier 2: Extract With CareModerate complexity. Needs ACL at boundaries and careful testing.
RedTier 3: DeferHigh complexity. Decompose or defer until dependencies are resolved.

The heatmap answers:

  1. Where is the risk? — Red zones need senior engineering judgment
  2. What can we extract today? — Green zones are safe starting points
  3. What needs decomposition? — God-classes (>2,000 LOC) should be split before extraction
  4. Where should parity tests focus? — High-complexity files need the most thorough testing