Debt Rating per Namespace

Quality Gate Quality Gates

Forbid namespaces with a poor Debt Rating of E or D.

The Debt Rating derives from the Debt Ratio (% of Debt Amount over estimated effort to develop the code element) and the thresholds in Debt Settings. The effort to develop is inferred from lines of code and the man-days to develop 1000 logical lines of code setting.

The Quality Gate can be modified to match assemblies, types or methods.

CQLinq source

This quality gate 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.

// <QualityGate Name="Debt Rating per Namespace" Unit="namespaces" />
failif count > 0 namespaces

from n in Application.Namespaces
where n.DebtRating() != null &&
      n.DebtRating().Value.EqualsAny(DebtRating.E, DebtRating.D)
select new { 
   n, 
   debtRating = n.DebtRating(),
   debtRatio = n.DebtRatio(),  // % of debt from which DebtRating is inferred
   devTimeInManDay = n.EffortToDevelop().ToDebt(), 
   debtInManDay = n.AllDebt(),
   issues = n.AllIssues() 
}

// <Desc>
// Forbid namespaces with a poor Debt Rating of **E** or **D**.
//
// The **Debt Rating** derives from the **Debt Ratio** (% of **Debt Amount**
// over **estimated effort to develop the code element**) and the thresholds
// in *Debt Settings*. The effort to develop is inferred from lines of code
// and the *man-days to develop 1000 logical lines of code* setting.
//
// The Quality Gate can be modified to match assemblies, types or methods.
// </Desc>

Quality Gates: all 19 items