Interface IIssue
An instance of this class represents an issue.
public interface IIssue
- Extension Methods
Properties (16)
AnnualInterest
The estimated annual-interest generated by this issue, or in others words, the cost per year, to leave the issue unfixed.
AnnualInterest AnnualInterest { get; }
Property Value
AnnualInterestPercent
Gets this issue estimated annual interest percent, expressed in percent per year.
double AnnualInterestPercent { get; }
Property Value
Remarks
This issue annual interest percent is equal to 100 multiplied by this issue AnnualInterest divided by this issue Debt.
For example if the estimated cost-to-fix the issue (this issue Debt) is equal to 10 man-days, and the estimated cost-to-not-fix the issue is equal to 2 man-days per year
(this is this issue AnnualInterest) then the debt annual interest percent is 20% per year.
Notice that an annual interest percent higher than 100% means that during the next 12 monthes, it would be cheaper to fix the issue than not to fix it.
If this issue Debt is equal to Zero, this getter returns zero.
- See Also
BreakingPoint
Gets the time point from now when the estimated cost-to-not-fix this issue will reach the estimated cost-to-fix this issue. This time point is named the breaking point.
TimeSpan BreakingPoint { get; }
Property Value
Remarks
The breaking point is the issue Debt divided by the issue AnnualInterest.
For example if the estimated cost-to-fix the issue (this issue Debt) is equal to 10 man-days, and the estimated cost-to-not-fix the issue is equal to 2 man-days per year
(this is this issue AnnualInterest) then the issue breaking point is equal to 5 years from now.
Notice that a breaking point lower than a year means that during the next 12 monthes, it would be cheaper to fix the issue than not to fix it.
If this issue AnnualInterest is equal to Zero, this getter returns TimeSpan.Zero.
- See Also
CodeElement
Gets the code element that has the issue.
ICodeElement CodeElement { get; }
Property Value
Remarks
A code rule can rely on a ICompareContext object to query the diff between 2 snapshots of a code base, the newer snapshot and the baseline snapshot.
For example rules to detect API breaking changes fall in this category.
Such rule can match code elements in the baseline code base snapshot.
However the issue code element returned by this property necessarily belongs to the newer code base snapshot.
In such situation CodeElementInBaseline is the matched code element declared in the baseline code base,
and the code element returned by this property is the most inner parent code element of CodeElementInBaseline,
that has an equivalent in the newer code base snapshot.
For example if a removed method is matched, and its parent type hasen't been removed, this property returns its parent type declared in the newer code base.
Notice the particular case when the matched code element is an assembly removed or is a namespace/type/method/field declared in an assembly removed.
In such situation there is no most inner parent code element that has an equivalent in the newer code base snapshot
and this property returns the first application assembly of newer code base.
The reason an issue must be be declared in the newer code base snapshot, is because an IIssuesSet object
is related to a code base snapshot and not to the diff between 2 snapshots of a code base.
It wouldn't make sense that an IIssuesSet object contain some issues declared on elements of the baseline snapshot.
CodeElementInBaseline
Gets the code element declared in the baseline code base snapshot, that has the issue, or null.
ICodeElement CodeElementInBaseline { get; }
Property Value
Remarks
A code rule can rely on an ICompareContext object to query the diff between 2 snapshots of a code base, the newer snapshot and the baseline snapshot.
For example rules to detect API breaking changes fall in this category.
Such rule can match code elements in the baseline code base snapshot.
However, the issue code element returned by ICodeElement necessarily belongs to the newer code base snapshot.
In such situation this property returns the matched code element declared in the baseline code base,
and the code element returned by CodeElement is the most inner parent code element of CodeElementInBaseline,
that has an equivalent in the newer code base snapshot.
If not in the situation, which means that the matched code element is declared in the newer code base snapshot,
this property returns null.
CodeElementInBaselineWasRemoved
Gets a value indicating whether the code element declared in the baseline code base snapshot has no equivalent in the newer code base snapshot and thus, can be considered as removed..
bool CodeElementInBaselineWasRemoved { get; }
Property Value
Remarks
A code rule can rely on an ICompareContext object to query the diff between 2 snapshots of a code base, the newer snapshot and the baseline snapshot.
For example rules to detect API breaking changes fall in this category.
Such rule can match code elements in the baseline code base snapshot.
In such situation CodeElement returns the matched code element declared in the newer code base,
and CodeElementInBaseline returns the matched code element declared in the baseline code base.
However if CodeElementInBaseline has been removed and thus, has no equivalent in the newer code base snapshot,
the property CodeElement returns the most inner parent code element of CodeElementInBaseline,
that has an equivalent in the newer code base snapshot, and this property returns true to inform of this situation.
If not in this situation, this property returns false.
ColumnsNames
Gets the columns names corresponding to this issue Record.
IReadOnlyList<string> ColumnsNames { get; }
Property Value
- IReadOnlyList<string>
Returns the column names if GetIssues(IRule, IQueryExecutionSuccessResult, IssueReferenceRecord) has been called with the value IssueReferenceRecord.Yes, else returns null.
The columns names are the same than the ones obtained through IQueryExecutionSuccessResult.ColumnsNames.
- See Also
Debt
The estimated technical-debt generated by this issue, or in others words, the estimated effort to fix the issue.
Debt Debt { get; }
Property Value
IsSuppressed
Returns true is this issue has been suppresses by the usage of a SuppressMessageAttribute.
bool IsSuppressed { get; }
Property Value
Record
Gets the record of the IQueryExecutionSuccessResult.Records corresponding to this issue.
IRecord Record { get; }
Property Value
- IRecord
Returns record of the issue if GetIssues(IRule, IQueryExecutionSuccessResult, IssueReferenceRecord) has been called with the value IssueReferenceRecord.Yes, else returns null.
ReferenceRecord
Gets a value indicating if the issues is referencing the record.
IssueReferenceRecord ReferenceRecord { get; }
Property Value
Rule
The rule from which the issue is inferred.
IRule Rule { get; }
Property Value
Severity
The estimated severity of the issue.
Severity Severity { get; }
Property Value
Remarks
The severity of an issue is inferred from AnnualInterest and thresholds in DebtSettings.
The method ToSeverity(AnnualInterest) is used to obtain the severity.
SourceDecl
Returns the source file declaration of this issue, or null if not SourceFileDeclAvailable.
ISourceDecl SourceDecl { get; }
Property Value
- See Also
SourceFileDeclAvailable
Gets a value indicating whether source file declaration of this issue is available.
bool SourceFileDeclAvailable { get; }
Property Value
- bool
true if source file declaration is available for this code element.
Remarks
So far only C# code is parsed and also, source file declarations for abstract methods and fields are not retreived. This situation will evolve in the future.
- See Also
SuppressAttributeTag
If the issue is not imported and is IsSuppressed, returns the SuppressMessageAttribute attribute tag that suppressed it.
IAttributeTag SuppressAttributeTag { get; }
Property Value
Method (1)
TryGetExplanation(StringFormattingKind, IDebtFormatter, out string)
Try get an explanation string for this issue.
bool TryGetExplanation(StringFormattingKind stringFormattingKind, IDebtFormatter debtFormatter, out string explanation)
Parameters
stringFormattingKindStringFormattingKindThe formatting of the returned explanation.
debtFormatterIDebtFormatterA debt formatter object to format debt estimation(s) if any.
explanationstringThe issue explanation formatted.
Returns
- bool
true if the issue explanation is available.
Remarks
An explanation string is returned only if IssueReferenceRecord.Yes is used when obtaining the issues of a rule by calling the method ExtensionMethodsQuery.GetIssues(IRule, IQueryExecutionSuccessResult, IssueReferenceRecord).