From 7635caae384269b12d0b99f688775f91b21ab08b Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Tue, 13 Aug 2024 17:15:08 -0300 Subject: [PATCH] Add CompilationEnd tag to descriptors per RS1037 Due to how our code is structured, we were mising this analyzer from Roslyn that recommends adding the tag for descriptors used in copilation end diagnostics. --- samples/dotnet/SponsorLink/DiagnosticsManager.cs | 10 +++++----- src/Tests/Analyzer.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/dotnet/SponsorLink/DiagnosticsManager.cs b/samples/dotnet/SponsorLink/DiagnosticsManager.cs index 002cd182..68420c75 100644 --- a/samples/dotnet/SponsorLink/DiagnosticsManager.cs +++ b/samples/dotnet/SponsorLink/DiagnosticsManager.cs @@ -203,7 +203,7 @@ SponsorStatus GetOrSetStatus(Func> getAdditionalF string.Join(", ", sponsorable.Select(x => $"https://github.com/sponsors/{x}")), string.Join(" ", sponsorable)), helpLinkUri: "https://github.com/devlooped#sponsorlink", - WellKnownDiagnosticTags.NotConfigurable); + WellKnownDiagnosticTags.NotConfigurable, "CompilationEnd"); internal static DiagnosticDescriptor CreateExpiring(string[] sponsorable, string prefix) => new( $"{prefix}101", @@ -214,7 +214,7 @@ SponsorStatus GetOrSetStatus(Func> getAdditionalF isEnabledByDefault: true, description: string.Format(CultureInfo.CurrentCulture, Resources.Expiring_Description, string.Join(" ", sponsorable)), helpLinkUri: "https://github.com/devlooped#autosync", - "DoesNotSupportF1Help", WellKnownDiagnosticTags.NotConfigurable); + "DoesNotSupportF1Help", WellKnownDiagnosticTags.NotConfigurable, "CompilationEnd"); internal static DiagnosticDescriptor CreateExpired(string[] sponsorable, string prefix) => new( $"{prefix}102", @@ -225,7 +225,7 @@ SponsorStatus GetOrSetStatus(Func> getAdditionalF isEnabledByDefault: true, description: string.Format(CultureInfo.CurrentCulture, Resources.Expired_Description, string.Join(" ", sponsorable)), helpLinkUri: "https://github.com/devlooped#autosync", - "DoesNotSupportF1Help", WellKnownDiagnosticTags.NotConfigurable); + "DoesNotSupportF1Help", WellKnownDiagnosticTags.NotConfigurable, "CompilationEnd"); internal static DiagnosticDescriptor CreateSponsor(string[] sponsorable, string prefix, bool hidden = false) => new( $"{prefix}105", @@ -236,7 +236,7 @@ SponsorStatus GetOrSetStatus(Func> getAdditionalF isEnabledByDefault: true, description: Resources.Sponsor_Description, helpLinkUri: "https://github.com/devlooped#sponsorlink", - "DoesNotSupportF1Help"); + "DoesNotSupportF1Help", "CompilationEnd"); internal static DiagnosticDescriptor CreateContributor(string[] sponsorable, string prefix, bool hidden = false) => new( $"{prefix}106", @@ -247,5 +247,5 @@ SponsorStatus GetOrSetStatus(Func> getAdditionalF isEnabledByDefault: true, description: Resources.Contributor_Description, helpLinkUri: "https://github.com/devlooped#sponsorlink", - "DoesNotSupportF1Help"); + "DoesNotSupportF1Help", "CompilationEnd"); } diff --git a/src/Tests/Analyzer.cs b/src/Tests/Analyzer.cs index ae509c4c..c5575f8e 100644 --- a/src/Tests/Analyzer.cs +++ b/src/Tests/Analyzer.cs @@ -10,7 +10,7 @@ namespace Devlooped.Tests; [DiagnosticAnalyzer(LanguageNames.CSharp)] public class TestSponsorLink : DiagnosticAnalyzer { - static DiagnosticDescriptor descriptor = new("IDE001", "IDE", "IDE", "Design", DiagnosticSeverity.Warning, true); + static DiagnosticDescriptor descriptor = new("IDE001", "IDE", "IDE", "Design", DiagnosticSeverity.Warning, true, customTags: ["CompilationEnd"]); public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(descriptor);