Types to Fix Priority

Code Query Hot Spots

Lists types per increasing Debt Breaking Point: the duration from now when the cost of leaving issues unfixed (Annual Interest) equals the fix effort (Debt). The shorter, the higher the fix ROI.

New/refactored types since baseline often come first: their issues get a higher Annual Interest since new issues should be fixed first.

--

Issues on the type and its members are both counted. Only types with at least 30 minutes of Debt are listed (Breaking Point makes less sense on small Debt). 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.

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 to Fix Priority</Name>
from t in JustMyCode.Types
where t.AllBreakingPoint() > TimeSpan.Zero &&
      t.AllDebt().Value > 30.ToMinutes()
orderby t.AllBreakingPoint().TotalMinutes ascending
select new { t, 
   BreakingPoint = t.AllBreakingPoint(),
   Debt = t.AllDebt(),
   AnnualInterest = t.AllAnnualInterest(),
   Issues = t.AllIssues(),
   t.NbLinesOfCode,
   // t.PercentageCoverage,  to uncomment if coverage data is imported
   DebtRating = t.DebtRating(), 
   DebtRatio = t.DebtRatio() 
}

//<Desc>
// Lists types per increasing **Debt Breaking Point**: the duration from now
// when the cost of leaving issues unfixed (*Annual Interest*) equals the fix
// effort (*Debt*). The shorter, the higher the fix ROI.
//
// New/refactored types since baseline often come first: their issues get a
// higher *Annual Interest* since new issues should be fixed first.
//
// --
//
// Issues on the type and its members are both counted. Only types with at
// least 30 minutes of Debt are listed (*Breaking Point* makes less sense on
// small Debt). 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.
//</Desc>

Hot Spots: all 7 items