Table of Contents

Class ExtensionMethodsCQLinqIssuesSet

Namespace
NDepend.Reserved.CQLinq
Assembly
NDepend.API.dll

Presents extension methods on rules and code elements, that provide a syntax friendly way to gather debt and issues data in CQLinq rules queries.

public static class ExtensionMethodsCQLinqIssuesSet
Inheritance
ExtensionMethodsCQLinqIssuesSet
Inherited Members

Remarks

These extension methods exist for CQLinq friendly syntax reasons and can only be called in a ICQLinqExecutionContext.
Indeed they all rely on a hidden IIssuesSet object, hidden in CQLinq queries. This results in less syntax burden.
At CQLinq compilation time, the CQLinq compiler takes care of transforming calls to these extension methods into calls to methods of a IIssuesSet object.
Indeed each of these extension methods, has an equivalent method defined by IIssuesSet, that can be called from a program that consumes NDepend.API.

Methods (24)

AllAnnualInterest(ICodeElement)

Gets the summed annual-interest of all issues relative to codeElement, and relative to all its children code elements, defined by codeElement.RecursiveChildren, if codeElement is a ICodeElementParent.

public static AnnualInterest AllAnnualInterest(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

AnnualInterest

Remarks

This property getter has a constant time complexity.
If codeElement is a IMethod or a IField, it is not a ICodeElementParent and this method is equivalent to this.AnnualInterest(ICodeElement).

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AllAnnualInterestIn(ICodeElement) must be called instead.

AllAnnualInterestPercent(ICodeElement)

public static double AllAnnualInterestPercent(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

double

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AllAnnualInterestPercentIn(ICodeElement) must be called instead.

AllBreakingPoint(ICodeElement)

public static TimeSpan AllBreakingPoint(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

TimeSpan

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AllBreakingPointIn(ICodeElement) must be called instead.

AllDebt(ICodeElement)

Gets the summed debt of all issues relative to codeElement, and relative to all its children code elements, defined by codeElement.RecursiveChildren, if codeElement is a ICodeElementParent.

public static Debt AllDebt(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

Debt

Remarks

This property getter has a constant time complexity.
If codeElement is a IMethod or a IField, it is not a ICodeElementParent and this method is equivalent to this.Debt(ICodeElement).

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AllDebtIn(ICodeElement) must be called instead.

AllIssues(ICodeElement)

Gets all issues relative to codeElement, and relative to all its child code elements, defined by codeElement.RecursiveChildren, if codeElement is a ICodeElementParent.

public static IEnumerable<IIssue> AllIssues(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

IEnumerable<IIssue>

Remarks

This property getter has a O(codeElement.RecursiveChildren.Count<TSource>(IEnumerable<TSource>)) time complexity.
If codeElement is a ICodeBase this method has a constant time complexity.
If codeElement is a IMethod or a IField, it is not a ICodeElementParent and this method is equivalent to this.Issues(ICodeElement).

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AllIssuesIn(ICodeElement) must be called instead.

AllIssuesCount(ICodeElement)

Gets the count of all issues relative to codeElement, and relative to all its children code elements, defined by codeElement.RecursiveChildren, if codeElement is a ICodeElementParent.

public static uint AllIssuesCount(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

uint

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AllIssuesCountIn(ICodeElement) must be called instead.

AnnualInterest(ICodeElement)

Gets the summed annual-interest of all issues relative to codeElement.

public static AnnualInterest AnnualInterest(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

AnnualInterest

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AnnualInterest(ICodeElement) must be called instead.

AnnualInterest(IRule)

Gets the summed annual-interest of all issues of rule.

public static AnnualInterest AnnualInterest(this IRule rule)

Parameters

rule IRule

The rule on which to get the issues.

Returns

AnnualInterest

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AnnualInterest(IRule) must be called instead.

AnnualInterestPercent(ICodeElement)

public static double AnnualInterestPercent(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

double

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AnnualInterestPercent(ICodeElement) must be called instead.

AnnualInterestPercent(IRule)

public static double AnnualInterestPercent(this IRule rule)

Parameters

rule IRule

The rule on which to get the is-violated value.

Returns

double

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.AnnualInterestPercent(IRule) must be called instead.

BreakingPoint(ICodeElement)

public static TimeSpan BreakingPoint(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

TimeSpan

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.BreakingPoint(ICodeElement) must be called instead.

BreakingPoint(IRule)

public static TimeSpan BreakingPoint(this IRule rule)

Parameters

rule IRule

The rule on which to get the is-violated value.

Returns

TimeSpan

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.BreakingPoint(IRule) must be called instead.

CostToReachBetterRating(ICodeElement)

Returns the estimated cost, to reach a better rating, based on the fact that codeElement has actually a total debt estimated to AllDebt(ICodeElement)(codeElement).

public static Debt? CostToReachBetterRating(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element on which we infer the cost to reach a better rating.

Returns

Debt?

Remarks

Better rating means the rating just better than the actual one.
If code element actual rating is D, better rating is C.
If code element actual rating is B, better rating is A.
If code element actual rating is A, this method returns Debt.Zero.
This method implementation calls IDebtFormatter.CostToReachBetterRating(Debt, ICodeElement).
This method returns null if IDebtFormatter.ToDebtRatio(Debt, ICodeElement)(codeElement) returns null.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.CostToReachBetterRating(ICodeElement) must be called instead.

CostToReachRating(ICodeElement, DebtRating)

Returns the estimated effort to reach ratingToReach, based on the fact that codeElement has actually a total debt estimated to AllDebt(ICodeElement)(codeElement).

public static Debt? CostToReachRating(this ICodeElement codeElement, DebtRating ratingToReach)

Parameters

codeElement ICodeElement

The code element on which we infer the cost to reach ratingToReach.

ratingToReach DebtRating

The rating to reach for codeElement

Returns

Debt?

Remarks

If the actual rating of DebtRating(ICodeElement)(codeElement) is equals or better than ratingToReach, this method returns a zero duration Debt value.
This method implementation calls IDebtFormatter.CostToReachRating(Debt, ICodeElement, DebtRating).
This method returns null if IDebtFormatter.ToDebtRatio(Debt, ICodeElement)(codeElement) returns null.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.CostToReachRating(ICodeElement, DebtRating) must be called instead.

Debt(ICodeElement)

Gets the summed debt of all issues relative to codeElement.

public static Debt Debt(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

Debt

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.Debt(ICodeElement) must be called instead.

Debt(IRule)

Gets the summed debt of all issues of rule.

public static Debt Debt(this IRule rule)

Parameters

rule IRule

The rule on which to get the issues.

Returns

Debt

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.Debt(IRule) must be called instead.

DebtRating(ICodeElement)

Gets the debt rating of codeElement in the range A (very good) to E (very bad).

public static DebtRating? DebtRating(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element on which we infer the rating.

Returns

DebtRating?

Remarks

The debt to infer the rating is obtained through AllDebt(ICodeElement)(codeElement).
This method implementation calls IDebtFormatter.ToDebtRating(Debt, ICodeElement).
This method returns null if IDebtFormatter.ToDebtRatio(Debt, ICodeElement)(codeElement) returns null.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.DebtRating(ICodeElement) must be called instead.

DebtRatio(ICodeElement)

Estimate the ratio of technical debt, measured through AllDebt(ICodeElement)(codeElement). This ratio is expressed in percentage, of estimated debt, compared to the estimated time it would take to rewrite codeElement from scratch.

public static double? DebtRatio(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element on which we infer the percentage of debt.

Returns

double?

Remarks

This method implementation calls IDebtFormatter.ToDebtRatio(Debt, ICodeElement) and returns null if ToDebtRatio(Debt, ICodeElement) returns null, which happens when the PDB file is not found for the assembly containing codeElement, which means that GetNbLinesOfCode_GuaranteedIfPDBFound(ICodeElement) returns null.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.DebtRatio(ICodeElement) must be called instead.

HasAnnualInterest(ICodeElement)

Gets a value indicating whether the codeElement has annual-interest or not.

public static bool HasAnnualInterest(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

bool

Remarks

If codeElement has only issues with AnnualInterest.Zero, this getter returns false. This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.HasAnnualInterest(ICodeElement) must be called instead.

HasDebt(ICodeElement)

Gets a value indicating whether the codeElement has debt or not.

public static bool HasDebt(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

bool

Remarks

If codeElement has only issues with Debt.Zero, this getter returns false. This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.HasDebt(ICodeElement) must be called instead.

HasIssue(ICodeElement)

Gets a value indicating whether the codeElement has issues or not.

public static bool HasIssue(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

bool

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.HasIssue(ICodeElement) must be called instead.

IsViolated(IRule)

Gets a value that indicates if the rule is violated in the context of this issues-set.

public static bool IsViolated(this IRule rule)

Parameters

rule IRule

The rule on which to get the is-violated value.

Returns

bool

Remarks

The returned value is the value of IQueryExecutionSuccessResult.IsARuleViolated of the IQueryExecutionSuccessResult object used when calling the method GetIssues(IRule, IQueryExecutionSuccessResult).

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.IsViolated(IRule) must be called instead.

Issues(ICodeElement)

Gets all issues relative to codeElement.

public static IEnumerable<IIssue> Issues(this ICodeElement codeElement)

Parameters

codeElement ICodeElement

The code element.

Returns

IEnumerable<IIssue>

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.Issues(ICodeElement) must be called instead.

Issues(IRule)

Gets all issues of rule.

public static IEnumerable<IIssue> Issues(this IRule rule)

Parameters

rule IRule

The rule on which to get the issues.

Returns

IEnumerable<IIssue>

Remarks

This property getter has a constant time complexity.

Exceptions

NotImplementedException

This extension method cannot be called from a program consuming NDepend.API. In such context, the method IIssuesSet.Issues(IRule) must be called instead.

See Also