Class ExtensionMethodsQuery
Exposes base operations concerning code query strings, compile and execute.
public static class ExtensionMethodsQuery
- Inheritance
-
ExtensionMethodsQuery
- Inherited Members
Methods (37)
Compile(string, ICodeBase)
Compile this code query string against a code base.
public static IQueryCompiled Compile(this string queryString, ICodeBase codeBase)
Parameters
queryStringstringThis code query string.
codeBaseICodeBaseThe code base against which to compile.
Returns
- IQueryCompiled
The code query compiled.
Remarks
codeBase is needed because this code query might reference some code elements by name.
Compile(string, ICompareContext)
Compile this code query string against a ICompareContext object. This overload of Compile(string, ICodeBase) is required if the code query is meant to be executed in a comparison context.
public static IQueryCompiled Compile(this string queryString, ICompareContext compareContext)
Parameters
queryStringstringThis code query string.
compareContextICompareContextThe ICompareContext object against which to compile.
Returns
- IQueryCompiled
This code query compiled.
Remarks
The ICompareContext object is needed because the code query might reference some code elements by name.
In such situation, code elements are resolved by name against the code base ICompareContext.NewerCodeBase.
The property IQueryCompiledSuccess.RelyOnCompareContext is equal to true if a code query is meant to be executed in a comparison context.
- See Also
CompileMany(IEnumerable<IQuery>, ICodeBase)
Compile against a code base, several code queries.
public static IDictionary<IQuery, IQueryCompiled> CompileMany(this IEnumerable<IQuery> queries, ICodeBase codeBase)
Parameters
queriesIEnumerable<IQuery>This collection of code queries.
codeBaseICodeBaseThe code base against which to compile each query.
Returns
- IDictionary<IQuery, IQueryCompiled>
A dictionary where keys are IQuery objects, and values are IQueryCompiled objects.
Remarks
The codeBase is needed because a code query might reference some code elements by name.
To compile N CQLinq queries, calling once CompileMany() is much faster than calling N times Compile().
CompileMany(IEnumerable<IQuery>, ICompareContext)
Compile several code queries, against a ICompareContext object. This overload of CompileMany(IEnumerable<IQuery>, ICodeBase) is required if some code queries are meant to be executed in a comparison context.
public static IDictionary<IQuery, IQueryCompiled> CompileMany(this IEnumerable<IQuery> queries, ICompareContext compareContext)
Parameters
queriesIEnumerable<IQuery>This collection of code queries.
compareContextICompareContextThe ICompareContext object against which to compile.
Returns
- IDictionary<IQuery, IQueryCompiled>
A dictionary where keys are IQuery objects, and values are IQueryCompiled objects.
Remarks
The ICompareContext object is needed because some code queries might reference some code elements by name.
In such situation, code elements are resolved by name against the code base ICompareContext.NewerCodeBase.
To compile N CQLinq queries, calling once CompileMany() is much faster than calling N times Compile().
The property IQueryCompiledSuccess.RelyOnCompareContext is equal to true if a code query is meant to be executed in a comparison context.
- See Also
CompileMany(IEnumerable<string>, ICodeBase)
Compile against a code base, several code queries contained in this collection of string.
public static IReadOnlyList<IQueryCompiled> CompileMany(this IEnumerable<string> queryStrings, ICodeBase codeBase)
Parameters
queryStringsIEnumerable<string>This collection of code queries string.
codeBaseICodeBaseThe code base against which to compile each query.
Returns
- IReadOnlyList<IQueryCompiled>
A read-only list of code queries compiled, with a count equals to
queryStrings.Count.
Remarks
The codeBase is needed because a code query might reference some code elements by name.
To compile N CQLinq queries strings, calling once CompileMany() is much faster than calling N times Compile().
CompileMany(IEnumerable<string>, ICompareContext)
Compile several code queries contained in this collection of string, against a ICompareContext object. This overload of CompileMany(IEnumerable<string>, ICodeBase) is required if some code queries are meant to be executed in a comparison context.
public static IReadOnlyList<IQueryCompiled> CompileMany(this IEnumerable<string> queryStrings, ICompareContext compareContext)
Parameters
queryStringsIEnumerable<string>This collection of code queries string.
compareContextICompareContextThe ICompareContext object against which to compile.
Returns
- IReadOnlyList<IQueryCompiled>
A read-only list of code queries compiled, with a count equals to
queryStrings.Count.
Remarks
The ICompareContext object is needed because some code queries might reference some code elements by name.
In such situation, code elements are resolved by name against the code base ICompareContext.NewerCodeBase.
To compile N CQLinq queries strings, calling once CompileMany() is much faster than calling N times Compile().
The property IQueryCompiledSuccess.RelyOnCompareContext is equal to true if a code query is meant to be executed in a comparison context.
- See Also
CompileManyNoResolve(IEnumerable<IQuery>)
Compile several code queries contained in this collection of IQuery objects, with no resolving of code elements referenced by the code queries.
public static IDictionary<IQuery, IQueryCompiledUnresolved> CompileManyNoResolve(this IEnumerable<IQuery> queries)
Parameters
queriesIEnumerable<IQuery>This collection of code queries.
Returns
- IDictionary<IQuery, IQueryCompiledUnresolved>
A dictionary where keys are IQuery objects, and values are IQueryCompiledUnresolved objects.
CompileManyNoResolve(IEnumerable<string>)
Compile several code queries contained in this collection of string, with no resolving of code elements referenced by the code queries.
public static IReadOnlyList<IQueryCompiledUnresolved> CompileManyNoResolve(this IEnumerable<string> queryStrings)
Parameters
queryStringsIEnumerable<string>This collection of code queries string.
Returns
- IReadOnlyList<IQueryCompiledUnresolved>
A read-only list of code queries compiled but unresolved, with a count equals to
queryStrings.Count.
CompileNoResolve(string)
Compile this code query string with no resolving of code elements referenced by the code query.
public static IQueryCompiledUnresolved CompileNoResolve(this string queryString)
Parameters
queryStringstringThis code query string.
Returns
- IQueryCompiledUnresolved
The code query compiled but unresolved.
ComputeJustMyCode(IGroupOfGroups, ICodeBase)
Computes and returns the set of just-my-code code elements from this groupOfGroupsCQLinq queries with a IQueryCompiled.KindOfCodeQueryExpression equals to NotMyCode.
public static ICodeBaseView ComputeJustMyCode(this IGroupOfGroups groupOfGroups, ICodeBase codeBase)
Parameters
groupOfGroupsIGroupOfGroupsThis set of code queries.
codeBaseICodeBaseThe code base.
Returns
- See Also
ConvertToCQLinq(IQueryCompiledSuccess)
Convert this code query compiled successfully to a CQLinq query string. This method is useful to convert a query from the CQL syntax to the CQLinq syntax.
public static string ConvertToCQLinq(this IQueryCompiledSuccess queryCompiledSuccess)
Parameters
queryCompiledSuccessIQueryCompiledSuccessThis code query compiled successfully.
Returns
- string
A string containing the query converted to CQLinq syntax, if
queryCompiledSuccessis a CQL query compiled.queryCompiledSuccess.OriginalQueryString, ifqueryCompiledSuccessis a CQLinq query compiled.
Execute(IQueryCompiledSuccess)
Execute a code query compiled successfully.
public static IQueryExecutionResult Execute(this IQueryCompiledSuccess queryCompiledSuccess)
Parameters
queryCompiledSuccessIQueryCompiledSuccessThis code query compiled successfully.
Returns
- IQueryExecutionResult
The query execution result.
Remarks
The code base or the ICompareContext object against which the query is executed, has been specified at compile time.
With this overload of Execute, just-my-code is the ICodeBase.Application specified at compile time.
Execute(IQueryCompiledSuccess, ICodeBaseView)
Execute this code query compiled successfully, with justMyCode defined.
public static IQueryExecutionResult Execute(this IQueryCompiledSuccess queryCompiledSuccess, ICodeBaseView justMyCode)
Parameters
queryCompiledSuccessIQueryCompiledSuccessThis code query compiled successfully.
justMyCodeICodeBaseViewThe code base view representing just-my-code, typically obtained through ComputeJustMyCode(IGroupOfGroups, ICodeBase).
Returns
- IQueryExecutionResult
The query execution result.
Remarks
The code base or the ICompareContext object against which the query is executed, has been specified at compile time.
- See Also
Execute(IQueryCompiledSuccess, ICodeBaseView, TimeSpan)
Execute this code query compiled successfully, with justMyCode defined and with a time out precised.
public static IQueryExecutionResult Execute(this IQueryCompiledSuccess queryCompiledSuccess, ICodeBaseView justMyCode, TimeSpan cqlinqQueryExecTimeOut)
Parameters
queryCompiledSuccessIQueryCompiledSuccessThis code query compiled successfully.
justMyCodeICodeBaseViewThe code base view representing just-my-code, typically obtained through ComputeJustMyCode(IGroupOfGroups, ICodeBase).
cqlinqQueryExecTimeOutTimeSpanThe time-out duration activated only for CQLinq queries, CQL queries being executed in a bounded short time.
Returns
- IQueryExecutionResult
The query execution result.
Remarks
The code base or the ICompareContext object against which the query is executed, has been specified at compile time.
- See Also
Execute(IQueryCompiledSuccess, QueryExecutionContext)
Execute the queryCompiledSuccess with the queryExecutionContext.
public static IQueryExecutionResult Execute(this IQueryCompiledSuccess queryCompiledSuccess, QueryExecutionContext queryExecutionContext)
Parameters
queryCompiledSuccessIQueryCompiledSuccessThis code query compiled successfully.
queryExecutionContextQueryExecutionContextThe query execution context that hold execution parameters.
Returns
Execute(IQueryCompiledSuccess, TimeSpan)
Execute his code query compiled successfully, with a time-out precised.
public static IQueryExecutionResult Execute(this IQueryCompiledSuccess queryCompiledSuccess, TimeSpan cqlinqQueryExecTimeOut)
Parameters
queryCompiledSuccessIQueryCompiledSuccessThis code query compiled successfully.
cqlinqQueryExecTimeOutTimeSpanThe time-out duration activated only for CQLinq queries, CQL queries being executed in a bounded short time.
Returns
- IQueryExecutionResult
The query execution result.
Remarks
The code base or the ICompareContext object against which the query is executed, has been specified at compile time.
With this overload of Execute, just-my-code is the ICodeBase.Application specified at compile time.
ExportQueryResult(IQueryExecutionResult, QueryResultExportDocumentKind, QueryResultExportFlags, IQuery, IDebtFormatter, string)
Export this queryExecutionResult to a document.
public static string ExportQueryResult(this IQueryExecutionResult queryExecutionResult, QueryResultExportDocumentKind exportDocumentKind, QueryResultExportFlags flags = QueryResultExportFlags.DefaultForExport, IQuery query = null, IDebtFormatter debtFormatter = null, string descriptionString = null)
Parameters
queryExecutionResultIQueryExecutionResultThis result to export.
exportDocumentKindQueryResultExportDocumentKindThe kind of document that will contain the exported result.
flagsQueryResultExportFlagsCan be set to determine the query result export properties.
queryIQueryOptional: null or the original IQuery object to refine the exported result with information like if it's a critical rule or not.
debtFormatterIDebtFormatterOptional: null or can be set to format technical-debt values to human-readable object, like man-months string or money amount.
descriptionStringstringOptional: null or can be set to prefix the result with a description string.
Returns
- string
The document content formatted as a string.
GenerateCompletionItems(string, int)
Compute a list of ICompletionItem objects, from queryString and carretLocation.
public static IReadOnlyList<ICompletionItem> GenerateCompletionItems(this string queryString, int carretLocation)
Parameters
Returns
GetCQLinqExecutionTimeOut()
Get the CQLinq rules and queries execution time-out defined in Tools > Options > CodeQuery > Time-Out.
public static TimeSpan GetCQLinqExecutionTimeOut()
Returns
GetIssues(IRule, IQueryExecutionSuccessResult)
Gets issues of rule from queryExecutionSuccessResult.
public static IRuleIssues GetIssues(this IRule rule, IQueryExecutionSuccessResult queryExecutionSuccessResult)
Parameters
ruleIRuleThe issues built rule, that can be obtained from IIssue.Rule.
queryExecutionSuccessResultIQueryExecutionSuccessResultThe query execution success result from which issues are inferred.
Returns
Remarks
This overload doesn't take a collection of usages of SuppressMessageAttribute.
As a consequence IRule.SuppressedIssues won't be filled.
This methods calls GetIssues(IRule, IQueryExecutionSuccessResult, IssueReferenceRecord) with the value IssueReferenceRecord.No.
A rule prefix can be warnif count == 0 which means that the value of IRuleIssues.IsRuleViolated of the returned IRuleIssues can be true even if Issues is empty.
However if IsARuleViolated is false, Issues is empty even if the rule has some match.
The DebtSettings object used to infer default values for debt and annual-interest (if these evalues are not provided by queryExecutionSuccessResult).
and used to provide thresholds to compute IIssue.Severity, is the DebtSettings object
that was set in QueryExecutionContext.DebtSettings.
GetIssues(IRule, IQueryExecutionSuccessResult, IssueReferenceRecord)
Gets issues of rule from queryExecutionSuccessResult.
public static IRuleIssues GetIssues(this IRule rule, IQueryExecutionSuccessResult queryExecutionSuccessResult, IssueReferenceRecord issueReferenceRecord)
Parameters
ruleIRuleThe issues built rule, that can be obtained from IIssue.Rule.
queryExecutionSuccessResultIQueryExecutionSuccessResultThe query execution success result from which issues are inferred.
issueReferenceRecordIssueReferenceRecordIf this parameter value equals IssueReferenceRecord.Yes, each issue in the returned IRuleIssues object will reference will reference its corresponding record in
queryExecutionSuccessResult.Records, through IIssue.Record. When an issue is referencing the record, the method IIssue.TryGetExplanation(StringFormattingKind, IDebtFormatter, out string) can return the explanation.
Returns
Remarks
This overload doesn't take a collection of usages of SuppressMessageAttribute.
As a consequence IRule.SuppressedIssues won't be filled.
A rule prefix can be warnif count == 0 which means that the value of IRuleIssues.IsRuleViolated of the returned IRuleIssues can be true even if Issues is empty.
However if IsARuleViolated is false, Issues is empty even if the rule has some match.
The DebtSettings object used to infer default values for debt and annual-interest (if these evalues are not provided by queryExecutionSuccessResult).
and used to provide thresholds to compute IIssue.Severity, is the DebtSettings object
that was set in QueryExecutionContext.DebtSettings.
GetIssues(IRule, IQueryExecutionSuccessResult, IssueReferenceRecord, IDictionary<RuleIdOrCategory, IReadOnlyList<ISuppressMessage>>)
Gets issues of rule from queryExecutionSuccessResult.
public static IRuleIssues GetIssues(this IRule rule, IQueryExecutionSuccessResult queryExecutionSuccessResult, IssueReferenceRecord issueReferenceRecord, IDictionary<RuleIdOrCategory, IReadOnlyList<ISuppressMessage>> suppressedMessages)
Parameters
ruleIRuleThe issues built rule, that can be obtained from IIssue.Rule.
queryExecutionSuccessResultIQueryExecutionSuccessResultThe query execution success result from which issues are inferred.
issueReferenceRecordIssueReferenceRecordIf this parameter value equals IssueReferenceRecord.Yes, each issue in the returned IRuleIssues object will reference will reference its corresponding record in
queryExecutionSuccessResult.Records, through IIssue.Record.suppressedMessagesIDictionary<RuleIdOrCategory, IReadOnlyList<ISuppressMessage>>The usages of SuppressMessageAttribute collection used to infer IRuleIssues.SuppressedIssues
Returns
Remarks
A rule prefix can be warnif count == 0 which means that the value of IRuleIssues.IsRuleViolated of the returned IRuleIssues can be true even if Issues is empty.
However if IsARuleViolated is false, Issues is empty even if the rule has some match.
The DebtSettings object used to infer default values for debt and annual-interest (if these evalues are not provided by queryExecutionSuccessResult).
and used to provide thresholds to compute IIssue.Severity, is the DebtSettings object
that was set in QueryExecutionContext.DebtSettings.
Calling this method might modify the queryExecutionSuccessResult object because of suppressed issues.
If some issues are suppressed, the following properties might return a different result after calling this method:
queryExecutionSuccessResult.IsARuleViolated,
queryExecutionSuccessResult.MatchedCodeElements,
queryExecutionSuccessResult.Records.
In such case you can find the suppressed issues in the result IRuleIssues.SuppressedIssues.
GetIssues(IRule, IQueryExecutionSuccessResult, IDictionary<RuleIdOrCategory, IReadOnlyList<ISuppressMessage>>)
Gets issues of rule from queryExecutionSuccessResult.
public static IRuleIssues GetIssues(this IRule rule, IQueryExecutionSuccessResult queryExecutionSuccessResult, IDictionary<RuleIdOrCategory, IReadOnlyList<ISuppressMessage>> suppressedMessages)
Parameters
ruleIRuleThe issues built rule, that can be obtained from IIssue.Rule.
queryExecutionSuccessResultIQueryExecutionSuccessResultThe query execution success result from which issues are inferred.
suppressedMessagesIDictionary<RuleIdOrCategory, IReadOnlyList<ISuppressMessage>>The usages of SuppressMessageAttribute collection used to infer IRuleIssues.SuppressedIssues
Returns
Remarks
This methods calls GetIssues(IRule, IQueryExecutionSuccessResult, IssueReferenceRecord) with the value IssueReferenceRecord.No.
A rule prefix can be warnif count == 0 which means that the value of IRuleIssues.IsRuleViolated of the returned IRuleIssues can be true even if Issues is empty.
However if IsARuleViolated is false, Issues is empty even if the rule has some match.
The DebtSettings object used to infer default values for debt and annual-interest (if these evalues are not provided by queryExecutionSuccessResult).
and used to provide thresholds to compute IIssue.Severity, is the DebtSettings object
that was set in QueryExecutionContext.DebtSettings.
Calling this method might modify the queryExecutionSuccessResult object because of suppressed issues.
If some issues are suppressed, the following properties might return a different result after calling this method:
queryExecutionSuccessResult.IsARuleViolated,
queryExecutionSuccessResult.MatchedCodeElements,
queryExecutionSuccessResult.Records.
In such case you can find the suppressed issues in the result IRuleIssues.SuppressedIssues.
GetKindOfCodeQuerySyntax(string)
Determines this code query syntax, CQLinq or CQL, of a code query string.
public static KindOfCodeQuerySyntax GetKindOfCodeQuerySyntax(this string queryString)
Parameters
queryStringstringThis code query string.
Returns
- KindOfCodeQuerySyntax
The code query syntax.
Remarks
An heuristic is used that determines the code query syntax of a code query string, even if the query is not compilable.
GetQualityGate(IQueryExecutionSuccessResult)
Gets a IQualityGate object from queryExecutionSuccessResult.
public static IQualityGate GetQualityGate(this IQueryExecutionSuccessResult queryExecutionSuccessResult)
Parameters
queryExecutionSuccessResultIQueryExecutionSuccessResultThe query execution success result from which the IQualityGate obejct is inferred.
Returns
GetRule(IQuery)
public static IRule GetRule(this IQuery query)
Parameters
queryIQueryThe code query from which the rule object is inferred.
Returns
Remarks
The returned rule IRule.Provider equals RuleProvider.CodeQueryRule
The returned rule IRule.IsCritical equals query.IsCriticalRule.
These ExtensionMethodsQuery methods are used for IRule.Name, IRule.TryGetDescription(StringFormattingKind, out string) and IRule.TryGetHowToFix(StringFormattingKind, out string).
- TryGetQueryName(string, out string) (if fails, the gets the first 60 char of the code query string.
- TryGetQueryDescription(string, StringFormattingKind, out string).
- TryGetRuleHowToFix(string, StringFormattingKind, out string).
IsActiveAndAllParentGroupActive(IGroup)
Returns true if this group.IsActive is true, and all its parents' groups (recursive) are also active.
public static bool IsActiveAndAllParentGroupActive(this IGroup group)
Parameters
groupIGroupThe group object
Returns
IsActiveAndAllParentGroupActive(IQuery)
Returns true if this query.IsActive is true, and all its parents' groups (recursive) are also active.
public static bool IsActiveAndAllParentGroupActive(this IQuery query)
Parameters
queryIQueryThe query object
Returns
Remarks
A query is visible in the report only if it is active and all its parents groups are also active.
RecordCellValueToString(RecordCellValue, IDebtFormatter)
Get a string that describes this recordCellValue.
public static string RecordCellValueToString(this RecordCellValue recordCellValue, IDebtFormatter debtFormatter)
Parameters
recordCellValueRecordCellValueThe recordCellValue on which to get the description.
debtFormatterIDebtFormatterThe debtFormatter to format debt value if any.
Returns
ResolveMany(IEnumerable<IQueryCompiledUnresolved>, ICodeBase)
Resolve all query compiled of queriesCompiledUnresolved to codeBase, by calling for each query compiled object, IQueryCompiledUnresolved.Resolve(ICodeBase).
public static IReadOnlyList<IQueryCompiled> ResolveMany(this IEnumerable<IQueryCompiledUnresolved> queriesCompiledUnresolved, ICodeBase codeBase)
Parameters
queriesCompiledUnresolvedIEnumerable<IQueryCompiledUnresolved>The sequence of IQueryCompiledUnresolved objects.
codeBaseICodeBaseThe code base on which to resolve code elements referenced by each query compiled.
Returns
ResolveMany(IEnumerable<IQueryCompiledUnresolved>, ICompareContext)
Resolve all query compiled of queriesCompiledUnresolved to compareContext, by calling for each query compiled object, IQueryCompiledUnresolved.Resolve(ICodeBase).
public static IReadOnlyList<IQueryCompiled> ResolveMany(this IEnumerable<IQueryCompiledUnresolved> queriesCompiledUnresolved, ICompareContext compareContext)
Parameters
queriesCompiledUnresolvedIEnumerable<IQueryCompiledUnresolved>The sequence of IQueryCompiledUnresolved objects.
compareContextICompareContextThe compare context on which to resolve code elements referenced by each query compiled.
Returns
TryGetQueryDescription(string, StringFormattingKind, out string)
Try extract the query description from a query string.
public static bool TryGetQueryDescription(this string queryString, StringFormattingKind stringFormattingKind, out string queryDescription)
Parameters
queryStringstringThe query string.
stringFormattingKindStringFormattingKindThe string formatting kind of the output string.
queryDescriptionstringThe query description extracted.
Returns
- bool
true if the query description has been extracted, else returns false.
Remarks
The query description, if any, is enclosed between the tags <Desc> and </Desc>, or <Description> and </Description>, in one or several consecutive comment line(s) in the query string.
TryGetQueryIdAndExplicitId(string, RuleProvider, out string, out string)
Try extract the query id and explicit-id from a idAndExplicitId and a ruleProvider.
public static bool TryGetQueryIdAndExplicitId(this string idAndExplicitId, RuleProvider ruleProvider, out string id, out string explicitId)
Parameters
idAndExplicitIdstringThe is and explicit id.
ruleProviderRuleProviderThe rule provider.
idstringThe query id extracted
explicitIdstringThe query explicit-id extracted
Returns
- bool
true if the id and explicit-id name has been extracted, else returns false.
Remarks
The query name, if any, is enclosed between the tags <Id> and </Id> in a comment line in the query string.
TryGetQueryIdAndExplicitId(string, out string, out string)
Try extract the query id and explicit-id from a query string.
public static bool TryGetQueryIdAndExplicitId(this string queryString, out string id, out string explicitId)
Parameters
queryStringstringThe query string.
idstringThe query id extracted
explicitIdstringThe query explicit-id extracted
Returns
- bool
true if the id and explicit-id name has been extracted, else returns false.
Remarks
The query name, if any, is enclosed between the tags <Id> and </Id> in a comment line in the query string.
TryGetQueryName(string, out string)
Try extract the query name from a query string.
public static bool TryGetQueryName(this string queryString, out string queryName)
Parameters
Returns
- bool
true if the query name has been extracted, else returns false.
Remarks
The query name, if any, is enclosed between the tags <Name> and </Name> in a comment line in the query string.
TryGetQueryPrompt(string, StringFormattingKind, out string)
Try extract the prompt from an issue query string: the fix instructions NDepend.AI gives the coding agent that fixes the issues matched by the query.
public static bool TryGetQueryPrompt(this string queryString, StringFormattingKind stringFormattingKind, out string queryPrompt)
Parameters
queryStringstringThe query string.
stringFormattingKindStringFormattingKindThe string formatting kind of the output string.
queryPromptstringThe prompt extracted.
Returns
- bool
true if the prompt has been extracted, else returns false.
Remarks
The prompt, if any, is enclosed between the tags <Prompt> and </Prompt>, in one or several consecutive comment line(s) in the query string.
TryGetRuleHowToFix(string, StringFormattingKind, out string)
Try extract the how-to-fix-rule explanations from a rule string.
public static bool TryGetRuleHowToFix(this string ruleString, StringFormattingKind stringFormattingKind, out string ruleHowToFix)
Parameters
ruleStringstringThe rule string.
stringFormattingKindStringFormattingKindThe string formatting kind of the output string.
ruleHowToFixstringThe how-to-fix-rule explanations extracted from the rule string.
Returns
- bool
true if the how-to-fix-rule explanations has been extracted, else returns false.
Remarks
The how-to-fix-rule explanations, if any, is enclosed between the tags <HowToFix> and </HowToFix>.