Types Hot Spots

Code Query Hot Spots

Lists types with most Debt (largest fix effort), counting issues on the type and its members. Type size and coverage are shown since untested code generates much Debt (uncomment t.PercentageCoverage once coverage data is imported); Debt Rating and Debt Ratio too.

--

Debt estimates distance from clean code, not fix priority. Annual Interest estimates the annual cost of leaving issues unfixed (Severity derives from it). The Debt Breaking Point is when the cost of leaving an issue unfixed equals the fix effort: the shorter, the higher the ROI — the Breaking Point is the right metric to prioritize issues fix.

CQLinq source

This code query is written in CQLinq, C# LINQ over the NDepend code model. It ships with every new NDepend project: you can read it, adapt it, or use it as a starting point for your own custom rules.

// <Name>Types Hot Spots</Name>
from t in JustMyCode.Types
where t.AllDebt() > Debt.Zero && 
      t.AllAnnualInterest() > AnnualInterest.Zero
orderby t.AllDebt().Value.TotalMinutes descending
select new { t, 
   Debt = t.AllDebt(),
   Issues = t.AllIssues(), // AllIssues = {types issues} union {members issues}
   AnnualInterest = t.AllAnnualInterest(),
   BreakingPoint = t.AllBreakingPoint(),
   t.NbLinesOfCode,
   // t.PercentageCoverage,  to uncomment if coverage data is imported
   DebtRating = t.DebtRating(), 
   DebtRatio = t.DebtRatio() 
}

//<Desc>
// Lists **types with most Debt** (largest fix effort), counting issues on the
// type and its members. Type size and coverage are shown since untested code
// generates much Debt (uncomment *t.PercentageCoverage* once coverage data is
// imported); *Debt Rating* and *Debt Ratio* too.
//
// --
//
// *Debt* estimates distance from clean code, not fix priority. *Annual
// Interest* estimates the annual cost of leaving issues unfixed (*Severity*
// derives from it). The **Debt Breaking Point** is when the cost of leaving
// an issue unfixed equals the fix effort: the shorter, the higher the ROI —
// the **Breaking Point is the right metric to prioritize issues fix**.
//</Desc>

Hot Spots: all 7 items