• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ImmediatePlatform / Immediate.Apis / 28677000796

03 Jul 2026 06:14PM UTC coverage: 91.678% (+0.8%) from 90.893%
28677000796

push

github

web-flow
Strongly-typed Route Groups (#302)

* Revert `[RouteGroup]`
* Initial draft of strongly-typed Route Groups
* Initial analyzers
* Check target of `MapGroup`
* Better access to `HashCode`
* Fix braceless route group codefix
* Improve whitespace handling

427 of 453 new or added lines in 16 files covered. (94.26%)

6 existing lines in 1 file now uncovered.

1333 of 1454 relevant lines covered (91.68%)

3.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.02
/src/Immediate.Apis.Analyzers/MissingCustomizeGroupMethodAnalyzer.cs
1
using System.Collections.Immutable;
2
using Microsoft.CodeAnalysis;
3
using Microsoft.CodeAnalysis.Diagnostics;
4

5
namespace Immediate.Apis.Analyzers;
6

7
[DiagnosticAnalyzer(LanguageNames.CSharp)]
8
public sealed class MissingCustomizeGroupMethodAnalyzer : DiagnosticAnalyzer
9
{
10
        public static readonly DiagnosticDescriptor MissingCustomizeGroupMethod =
4✔
11
                new(
4✔
12
                        id: DiagnosticIds.IAPI0012MissingCustomizeGroupMethod,
4✔
13
                        title: "Missing `CustomizeGroup` method",
4✔
14
                        messageFormat: "Missing `CustomizeGroup` method in the class",
4✔
15
                        category: "ImmediateApis",
4✔
16
                        defaultSeverity: DiagnosticSeverity.Hidden,
4✔
17
                        isEnabledByDefault: true,
4✔
18
                        description: "A class with `RouteGroup` attribute can have a `CustomizeGroup` method."
4✔
19
                );
4✔
20

21
        public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
4✔
22
                ImmutableArray.Create(
4✔
23
                [
4✔
24
                        MissingCustomizeGroupMethod,
4✔
25
                ]);
4✔
26

27
        public override void Initialize(AnalysisContext context)
28
        {
29
                if (context == null)
4✔
NEW
30
                        throw new ArgumentNullException(nameof(context));
×
31

32
                context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
4✔
33
                context.EnableConcurrentExecution();
4✔
34

35
                context.RegisterSymbolAction(AnalyzeSymbol, SymbolKind.NamedType);
4✔
36
        }
4✔
37

38
        private static void AnalyzeSymbol(SymbolAnalysisContext context)
39
        {
40
                var token = context.CancellationToken;
4✔
41
                token.ThrowIfCancellationRequested();
4✔
42

43
                if (context.Symbol is not INamedTypeSymbol namedTypeSymbol)
4✔
NEW
44
                        return;
×
45

46
                if (!namedTypeSymbol
4✔
47
                                .GetAttributes()
4✔
48
                                .Any(x => x.AttributeClass.IsRouteGroupAttribute))
4✔
49
                {
NEW
50
                        return;
×
51
                }
52

53
                token.ThrowIfCancellationRequested();
4✔
54

55
                if (namedTypeSymbol
4✔
56
                                .GetMembers()
4✔
57
                                .OfType<IMethodSymbol>()
4✔
58
                                .Any(ims => ims.Name is "CustomizeGroup"))
4✔
59
                {
60
                        return;
4✔
61
                }
62

63
                token.ThrowIfCancellationRequested();
4✔
64

65
                context.ReportDiagnostic(
4✔
66
                        Diagnostic.Create(
4✔
67
                                MissingCustomizeGroupMethod,
4✔
68
                                namedTypeSymbol.Locations[0]
4✔
69
                        )
4✔
70
                );
4✔
71
        }
4✔
72
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc