< Summary

Information
Class: NexusLabs.Needlr.Logging.Analyzers.DiagnosticDescriptors
Assembly: NexusLabs.Needlr.Logging.Analyzers
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Logging.Analyzers/DiagnosticDescriptors.cs
Line coverage
100%
Covered lines: 54
Uncovered lines: 0
Coverable lines: 54
Total lines: 90
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Logging.Analyzers/DiagnosticDescriptors.cs

#LineLine coverage
 1using Microsoft.CodeAnalysis;
 2
 3namespace NexusLabs.Needlr.Logging.Analyzers;
 4
 5/// <summary>
 6/// Diagnostic descriptors for logging-specific Needlr analyzers.
 7/// </summary>
 8public static class DiagnosticDescriptors
 9{
 10    private const string Category = "NexusLabs.Needlr.Logging";
 11    private const string HelpLinkBase = "https://github.com/nexus-labs/needlr/blob/main/docs/analyzers/";
 12
 13    /// <summary>
 14    /// NDLRLOG001: a <c>[NeedlrLoggerMessage]</c> method must be <c>partial</c>.
 15    /// </summary>
 116    public static readonly DiagnosticDescriptor MustBePartial = new(
 117        id: DiagnosticIds.MustBePartial,
 118        title: "NeedlrLoggerMessage method must be partial",
 119        messageFormat: "Logging method '{0}' must be partial so its body can be generated",
 120        category: Category,
 121        defaultSeverity: DiagnosticSeverity.Error,
 122        isEnabledByDefault: true,
 123        description: "A method marked with [NeedlrLoggerMessage] must be declared partial so the source generator can su
 124        helpLinkUri: HelpLinkBase + "NDLRLOG001.md");
 25
 26    /// <summary>
 27    /// NDLRLOG002: a <c>[NeedlrLoggerMessage]</c> method must return <c>void</c>.
 28    /// </summary>
 129    public static readonly DiagnosticDescriptor MustReturnVoid = new(
 130        id: DiagnosticIds.MustReturnVoid,
 131        title: "NeedlrLoggerMessage method must return void",
 132        messageFormat: "Logging method '{0}' must return void",
 133        category: Category,
 134        defaultSeverity: DiagnosticSeverity.Error,
 135        isEnabledByDefault: true,
 136        description: "A method marked with [NeedlrLoggerMessage] must return void.",
 137        helpLinkUri: HelpLinkBase + "NDLRLOG002.md");
 38
 39    /// <summary>
 40    /// NDLRLOG003: a <c>[NeedlrLoggerMessage]</c> method must not be generic.
 41    /// </summary>
 142    public static readonly DiagnosticDescriptor MustNotBeGeneric = new(
 143        id: DiagnosticIds.MustNotBeGeneric,
 144        title: "NeedlrLoggerMessage method must not be generic",
 145        messageFormat: "Logging method '{0}' must not declare type parameters",
 146        category: Category,
 147        defaultSeverity: DiagnosticSeverity.Error,
 148        isEnabledByDefault: true,
 149        description: "A method marked with [NeedlrLoggerMessage] must not be generic.",
 150        helpLinkUri: HelpLinkBase + "NDLRLOG003.md");
 51
 52    /// <summary>
 53    /// NDLRLOG004: the type containing a <c>[NeedlrLoggerMessage]</c> method must be <c>partial</c>.
 54    /// </summary>
 155    public static readonly DiagnosticDescriptor ContainingTypeMustBePartial = new(
 156        id: DiagnosticIds.ContainingTypeMustBePartial,
 157        title: "Type containing a NeedlrLoggerMessage method must be partial",
 158        messageFormat: "Type '{0}' must be partial because it contains a [NeedlrLoggerMessage] method",
 159        category: Category,
 160        defaultSeverity: DiagnosticSeverity.Error,
 161        isEnabledByDefault: true,
 162        description: "The type containing a [NeedlrLoggerMessage] method must be declared partial so the generated imple
 163        helpLinkUri: HelpLinkBase + "NDLRLOG004.md");
 64
 65    /// <summary>
 66    /// NDLRLOG005: a <c>[NeedlrLoggerMessage]</c> method has no accessible <c>ILogger</c>.
 67    /// </summary>
 168    public static readonly DiagnosticDescriptor LoggerNotFound = new(
 169        id: DiagnosticIds.LoggerNotFound,
 170        title: "NeedlrLoggerMessage method has no accessible ILogger",
 171        messageFormat: "Logging method '{0}' has no accessible ILogger; an instance method needs an ILogger field or pro
 172        category: Category,
 173        defaultSeverity: DiagnosticSeverity.Error,
 174        isEnabledByDefault: true,
 175        description: "A [NeedlrLoggerMessage] method needs a logger: an instance method must have an ILogger field or pr
 176        helpLinkUri: HelpLinkBase + "NDLRLOG005.md");
 77
 78    /// <summary>
 79    /// NDLRLOG006: a <c>[NeedlrLoggerMessage]</c> method has more than six non-exception parameters.
 80    /// </summary>
 181    public static readonly DiagnosticDescriptor TooManyParameters = new(
 182        id: DiagnosticIds.TooManyParameters,
 183        title: "NeedlrLoggerMessage method exceeds the LoggerMessage.Define parameter limit",
 184        messageFormat: "Logging method '{0}' has {1} non-exception parameters; the allocation-free fast path supports at
 185        category: Category,
 186        defaultSeverity: DiagnosticSeverity.Info,
 187        isEnabledByDefault: true,
 188        description: "LoggerMessage.Define supports at most six message parameters. Methods with more parameters still w
 189        helpLinkUri: HelpLinkBase + "NDLRLOG006.md");
 90}

Methods/Properties

.cctor()