Skip to content

Commit cacaa2d

Browse files
committed
Add more clear descriptions to SL usage by nugetizer
1 parent 74c58fd commit cacaa2d

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

src/CodeAnalysis/SponsorLinker.cs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using System.Collections.Immutable;
3+
using System.Linq;
24
using Devlooped;
35
using Microsoft.CodeAnalysis;
46
using Microsoft.CodeAnalysis.Diagnostics;
@@ -8,14 +10,29 @@ namespace NuGetizer;
810
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic, LanguageNames.FSharp)]
911
class SponsorLinker : SponsorLink
1012
{
11-
public SponsorLinker() : base(SponsorLinkSettings.Create(
12-
"devlooped", "NuGetizer",
13-
version: new Version(ThisAssembly.Info.Version).ToString(3),
14-
// Add an extra digit so the SL diagnostics have the same length as ours
15-
diagnosticsIdPrefix: "NG1"
13+
static readonly SponsorLinkSettings settings;
14+
15+
static SponsorLinker()
16+
{
17+
settings = SponsorLinkSettings.Create(
18+
"devlooped", "NuGetizer",
19+
version: new Version(ThisAssembly.Info.Version).ToString(3),
20+
// Add an extra digit so the SL diagnostics have the same length as ours
21+
diagnosticsIdPrefix: "NG1"
1622
#if DEBUG
17-
, quietDays: 0
23+
, quietDays: 0
1824
#endif
19-
))
20-
{ }
25+
);
26+
27+
settings.SupportedDiagnostics = settings.SupportedDiagnostics
28+
.Select(x => x.IsKind(DiagnosticKind.AppNotInstalled) ?
29+
x.With(description: "Your package users will NOT have a dependency on SponsorLink OR NuGetizer. This is about *you* helping out the NuGetizer project itself. Thanks!") :
30+
x)
31+
.Select(x => x.IsKind(DiagnosticKind.UserNotSponsoring) ?
32+
x.With(description: "Your sponsorship is used to further develop NuGetizer and make it great for the entire oss community!") :
33+
x)
34+
.ToImmutableArray();
35+
}
36+
37+
public SponsorLinker() : base(settings) { }
2138
}

0 commit comments

Comments
 (0)