Table of Contents

Class DebtSettings

Namespace
NDepend.TechnicalDebt
Assembly
NDepend.API.dll

This class contains all settings needed to present a Debt value to the user.

public sealed class DebtSettings
Inheritance
DebtSettings
Inherited Members
Extension Methods

Constructor (1)

DebtSettings()

public DebtSettings()

Fields (12)

CRITICAL2BLOCKER_SEVERITY_THRESHOLD_DEFAULT

The default value for Critical2Blocker_SeverityThreshold.

public static readonly AnnualInterest CRITICAL2BLOCKER_SEVERITY_THRESHOLD_DEFAULT

Field Value

AnnualInterest

DEFAULT_COST_DEFAULT

The default value for DebtDefault and AnnualInterestDefault.

public static readonly TimeSpan DEFAULT_COST_DEFAULT

Field Value

TimeSpan

DEFAULT_COST_MAX

The maximum value for DebtDefault and AnnualInterestDefault.

public static readonly TimeSpan DEFAULT_COST_MAX

Field Value

TimeSpan

DEFAULT_COST_MIN

The minimum value for DebtDefault and AnnualInterestDefault.

public static readonly TimeSpan DEFAULT_COST_MIN

Field Value

TimeSpan

HIGH2CRITICAL_SEVERITY_THRESHOLD_DEFAULT

The default value for High2CriticalSeverityThreshold.

public static readonly AnnualInterest HIGH2CRITICAL_SEVERITY_THRESHOLD_DEFAULT

Field Value

AnnualInterest

INFO2MINOR_SEVERITY_THRESHOLD_DEFAULT

Use INFO2MINOR_SEVERITY_THRESHOLD_DEFAULT instead

[Obsolete("Use INFO2MINOR_SEVERITY_THRESHOLD_DEFAULT instead")]
public static readonly AnnualInterest INFO2MINOR_SEVERITY_THRESHOLD_DEFAULT

Field Value

AnnualInterest

LOW2MEDIUM_SEVERITY_THRESHOLD_DEFAULT

The default value for Low2MediumSeverityThreshold.

public static readonly AnnualInterest LOW2MEDIUM_SEVERITY_THRESHOLD_DEFAULT

Field Value

AnnualInterest

MAJOR2CRITICAL_SEVERITY_THRESHOLD_DEFAULT

Use HIGH2CRITICAL_SEVERITY_THRESHOLD_DEFAULT instead

[Obsolete("Use HIGH2CRITICAL_SEVERITY_THRESHOLD_DEFAULT instead")]
public static readonly AnnualInterest MAJOR2CRITICAL_SEVERITY_THRESHOLD_DEFAULT

Field Value

AnnualInterest

MEDIUM2HIGH_SEVERITY_THRESHOLD_DEFAULT

The default value for Medium2HighSeverityThreshold.

public static readonly AnnualInterest MEDIUM2HIGH_SEVERITY_THRESHOLD_DEFAULT

Field Value

AnnualInterest

MINOR2MAJOR_SEVERITY_THRESHOLD_DEFAULT

Use MEDIUM2HIGH_SEVERITY_THRESHOLD_DEFAULT instead

[Obsolete("Use MEDIUM2HIGH_SEVERITY_THRESHOLD_DEFAULT instead")]
public static readonly AnnualInterest MINOR2MAJOR_SEVERITY_THRESHOLD_DEFAULT

Field Value

AnnualInterest

SEVERITY_THRESHOLD_MAX

The maximum value for a severity threshold.

public static readonly AnnualInterest SEVERITY_THRESHOLD_MAX

Field Value

AnnualInterest

Remarks

Only Critical2Blocker_SeverityThreshold can be equals to this maximum.

SEVERITY_THRESHOLD_MIN

The minimum value for a severity threshold.

public static readonly AnnualInterest SEVERITY_THRESHOLD_MIN

Field Value

AnnualInterest

Remarks

Only Low2MediumSeverityThreshold can be equals to zero.

Properties (23)

A2B_RatingThreshold

Returns the percentage of technical debt under which, a code element gets the A rating.

public double A2B_RatingThreshold { get; }

Property Value

double

Remarks

The default value is 5%. A2B is the only threshold that can be equals to 0.0. In such case, it means that any cost-fix leads to a rating B or worst.

AnnualInterestDefault

The default AnnualInterest.Value for issues for which AnnualInterest is not defined.

public AnnualInterest AnnualInterestDefault { get; set; }

Property Value

AnnualInterest

Remarks

The default value is zero.

AnnualInterestFactor

A factor that multiplies AnnualInterest.Value of all issues.

public double AnnualInterestFactor { get; set; }

Property Value

double

Remarks

The default value is 1.0.

B2C_RatingThreshold

Returns the percentage of technical debt under which, a code element gets the B rating.

public double B2C_RatingThreshold { get; }

Property Value

double

Remarks

The default value is 10%.

C2D_RatingThreshold

Returns the percentage of technical debt under which, a code element gets the C rating.

public double C2D_RatingThreshold { get; }

Property Value

double

Remarks

The default value is 20%.

Critical2Blocker_SeverityThreshold

A AnnualInterest value below (or equals) the returned threshold has a Critical severity, and above the returned threshold, a Blocker severity.

public AnnualInterest Critical2Blocker_SeverityThreshold { get; }

Property Value

AnnualInterest

Remarks

The default value for this threshold is 10 man-hour.

Currency

Gets or sets the currency in which, MoneyPerManHour is expressed.

public string Currency { get; set; }

Property Value

string

Remarks

The default value is "USD".

CurrencyLocation

Gets or sets the currency location, before or after, the figure.

public BeforeAfter CurrencyLocation { get; set; }

Property Value

BeforeAfter

Remarks

The default value is BeforeAfter.Before.

D2E_RatingThreshold

Returns the percentage of technical debt under which, a code element gets the D rating. Any percentage of technical debt value higher than this value will get the E rating.

public double D2E_RatingThreshold { get; }

Property Value

double

Remarks

The default value is 50%.

DebtDefault

The default Debt.Value for issues for which Debt is not defined.

public Debt DebtDefault { get; set; }

Property Value

Debt

Remarks

The default value is zero.

DebtFactor

A factor that multiplies Debt.Value of all issues.

public double DebtFactor { get; set; }

Property Value

double

Remarks

The default value is 1.0.

DebtStringFormat

The debt string format used by IDebtFormatter.ToString(TimeSpan) method.

public string DebtStringFormat { get; set; }

Property Value

string

Remarks

The default value is DebtStringFormat. NDepend.TechnicalDebt.DebtStringFormat.TAG_MAN_DAY_DETAILLED.

See Also

EstimatedEffortToDevelopOneLogicalLineOfCode

Gets the estimated time to develop one logical line of code.

public TimeSpan EstimatedEffortToDevelopOneLogicalLineOfCode { get; }

Property Value

TimeSpan

Remarks

This property has no setter because the result is obtained from the formula:
(this.EstimatedNumberOfManDayToDevelop1000LogicalLinesOfCode * this.NumberOfWorkHourPerDay / 1000).ToHours(double).

EstimatedNumberOfManDayToDevelop1000LogicalLinesOfCode

Gets or sets the estimated number of man-days to develop 1.000 logical lines of code, as defined by NbLinesOfCode.

public double EstimatedNumberOfManDayToDevelop1000LogicalLinesOfCode { get; set; }

Property Value

double

Remarks

The debt ratio value of one or several issues on a code element, is obtained by this formula: 100 * estimated Debt of the issues / estimated effort to develop the code element.
The estimated Debt of the issues is the Debt value.
The estimated effort to develop the code element is obtained from this EstimatedNumberOfManDayToDevelop1000LogicalLinesOfCode value, and from the code element number of logical lines of code.
The value of this setting is just an estimation, in the short-term it is meaningless.
After a few man-years of development, this value is typically stable enough to rely on, for estimation purposes.
This estimation also needs to take account of the cost of writing unit-tests. The default value is 18 man-days which means an average of 55 new logical lines of code, 100% covered by unit-tests, written per day, per developer.

Lines of code as expressed by NbLinesOfCode is logical lines of code. This metric doesn't depend on formatting nor commenting and is inferred from # sequences points (gathered from PDB files).

See Also

High2CriticalSeverityThreshold

A AnnualInterest value below (or equals) the returned threshold has a High severity, and above the returned threshold, a Critical severity.

public AnnualInterest High2CriticalSeverityThreshold { get; }

Property Value

AnnualInterest

Remarks

The default value for this threshold is 2 man-hour.

Info2Minor_SeverityThreshold

Use Low2MediumSeverityThreshold instead

[Obsolete("Use Low2MediumSeverityThreshold instead")]
public AnnualInterest Info2Minor_SeverityThreshold { get; }

Property Value

AnnualInterest

Low2MediumSeverityThreshold

A AnnualInterest value below (or equals) the returned threshold has a Low severity, and above the returned threshold, a Medium severity.

public AnnualInterest Low2MediumSeverityThreshold { get; }

Property Value

AnnualInterest

Remarks

The default value for this threshold is 2 man-minute.

Major2Critical_SeverityThreshold

Use High2CriticalSeverityThreshold instead

[Obsolete("Use High2CriticalSeverityThreshold instead")]
public AnnualInterest Major2Critical_SeverityThreshold { get; }

Property Value

AnnualInterest

Medium2HighSeverityThreshold

A AnnualInterest value below (or equals) the returned threshold has a Medium severity, and above the returned threshold, a High severity.

public AnnualInterest Medium2HighSeverityThreshold { get; }

Property Value

AnnualInterest

Remarks

The default value for this threshold is 20 man-minute.

Minor2Major_SeverityThreshold

Use Medium2HighSeverityThreshold instead

[Obsolete("Use Medium2HighSeverityThreshold instead")]
public AnnualInterest Minor2Major_SeverityThreshold { get; }

Property Value

AnnualInterest

MoneyPerManHour

Gets or sets the average cost of a man-hour of developement, expressed in Currency.

public double MoneyPerManHour { get; set; }

Property Value

double

Remarks

The default value is 50.

NumberOfWorkDayPerYear

Gets or sets the number of worked day per developer per year. This value is used to format Debt and AnnualInterest values in terms of man-years and man-months.

public ushort NumberOfWorkDayPerYear { get; set; }

Property Value

ushort

Remarks

The default value is 240, which means 4 full weeks off and 48 full weeks worked.

NumberOfWorkHourPerDay

Gets or sets the number of worked hour per developer work day. This value is used to format Debt and AnnualInterest values in terms of man-days.

public double NumberOfWorkHourPerDay { get; set; }

Property Value

double

Remarks

The default value is 8. A developer typically doesn't spend 8 hours per day coding (because of email, meeting, discussion...) but this is not relevant, since this setting is used to format the Debt values in terms of man-days.
This cost necessarily includes side-costs like email or meeting costs, that represent an incompressible fraction of the productive time.

Methods (4)

Clone()

Create a new DebtSettings objects, with all settings values cloned from this.

public DebtSettings Clone()

Returns

DebtSettings

Equals(DebtSettings)

Returns true if all settings of other debt settings, are equals to this settings.

public bool Equals(DebtSettings other)

Parameters

other DebtSettings

Returns

bool

SetRatingThresholds(double, double, double, double)

Set the various thresholds used to infer the IDebtFormatter.ToDebtRating(Debt, ICodeElement) character value in the range of 'A' 'B' 'C' 'D' 'E', from the Debt Ratio of a code element.

public void SetRatingThresholds(double a2b, double b2c, double c2d, double d2e)

Parameters

a2b double

The A to B rating threshold of technical debt, used to infer the IDebtFormatter.ToDebtRating(Debt, ICodeElement) character value, from the percentage of technical debt of a code element.

b2c double

The B to C rating threshold of technical debt, used to infer the IDebtFormatter.ToDebtRating(Debt, ICodeElement) character value, from the percentage of technical debt of a code element.

c2d double

The C to D rating threshold of technical debt, used to infer the IDebtFormatter.ToDebtRating(Debt, ICodeElement) character value, from the percentage of technical debt of a code element.

d2e double

The D to E rating threshold of technical debt, used to infer the IDebtFormatter.ToDebtRating(Debt, ICodeElement) character value, from the percentage of technical debt of a code element.

Remarks

The IDebtFormatter.ToDebtRating(Debt, ICodeElement) method returns a character in the range 'A' 'B' 'C' 'D' 'E'.
This rating value is obtained from the ratio of technical debt of the code element, and the various thresholds assigned by this method.

SetSeverityThresholds(TimeSpan, TimeSpan, TimeSpan, TimeSpan)

Set the various thresholds used to infer the Severity of the AnnualInterest an issue expressed in man-time per year.

public void SetSeverityThresholds(TimeSpan low2Medium, TimeSpan medium2High, TimeSpan high2Critical, TimeSpan critical2Blocker)

Parameters

low2Medium TimeSpan

The value of Low2MediumSeverityThreshold.

medium2High TimeSpan

The value of NumberOfWorkHourPerDay to obtain Medium2HighSeverityThreshold.

high2Critical TimeSpan

The value of NumberOfWorkHourPerDay to obtain High2CriticalSeverityThreshold.

critical2Blocker TimeSpan

The value of NumberOfWorkHourPerDay to obtain Critical2Blocker_SeverityThreshold.

Remarks

The IDebtFormatter.ToSeverity(AnnualInterest) method is used to get the Severity of the AnnualInterest an issue.