Skip to content

Commit

Permalink
Add CompilationEnd tag to descriptors per RS1037
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kzu committed Aug 13, 2024
1 parent f6a4181 commit 7635caa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions samples/dotnet/SponsorLink/DiagnosticsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ SponsorStatus GetOrSetStatus(Func<ImmutableArray<AdditionalText>> 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",
Expand All @@ -214,7 +214,7 @@ SponsorStatus GetOrSetStatus(Func<ImmutableArray<AdditionalText>> 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",
Expand All @@ -225,7 +225,7 @@ SponsorStatus GetOrSetStatus(Func<ImmutableArray<AdditionalText>> 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",
Expand All @@ -236,7 +236,7 @@ SponsorStatus GetOrSetStatus(Func<ImmutableArray<AdditionalText>> 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",
Expand All @@ -247,5 +247,5 @@ SponsorStatus GetOrSetStatus(Func<ImmutableArray<AdditionalText>> getAdditionalF
isEnabledByDefault: true,
description: Resources.Contributor_Description,
helpLinkUri: "https://github.com/devlooped#sponsorlink",
"DoesNotSupportF1Help");
"DoesNotSupportF1Help", "CompilationEnd");
}
2 changes: 1 addition & 1 deletion src/Tests/Analyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(descriptor);

Expand Down

0 comments on commit 7635caa

Please sign in to comment.