Open sandboxFocus

Class DiagnosticsQueryExtensions

Extension methods for IQuery<TDeclaration> and ITaggedQuery<TDeclaration, TTag> that enable reporting and suppressing diagnostics on sets of declarations in fabrics.

Inheritance
DiagnosticsQueryExtensions
Namespace: Metalama.Framework.Diagnostics
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class DiagnosticsQueryExtensions
Remarks

These extension methods allow fabrics to report diagnostics or suppress diagnostics for multiple declarations at once using LINQ-like queries. This is particularly useful for implementing architecture rules or validation logic that applies to many declarations.

Use these methods in ProjectFabric, NamespaceFabric, or TypeFabric to validate code structure and report diagnostics based on query results.

Methods

Name Description
ReportDiagnostic<TDeclaration>(IQuery<TDeclaration>, Func<TDeclaration, IDiagnostic>)

Reports a diagnostic for each declaration selected by the query.

ReportDiagnostic<TDeclaration, TTag>(ITaggedQuery<TDeclaration, TTag>, Func<TDeclaration, TTag, IDiagnostic>)

Reports a diagnostic for each declaration selected by the tagged query, with access to the tag value.

SuppressDiagnostic<TDeclaration>(IQuery<TDeclaration>, Func<TDeclaration, SuppressionDefinition>)

Suppresses a diagnostic for each declaration selected by the query.

SuppressDiagnostic<TDeclaration, TTag>(ITaggedQuery<TDeclaration, TTag>, Func<TDeclaration, TTag, SuppressionDefinition>)

Suppresses a diagnostic for each declaration selected by the tagged query, with access to the tag value.

See Also