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

loresoft / FluentCommand / 23278216331

19 Mar 2026 03:19AM UTC coverage: 57.398% (+0.7%) from 56.658%
23278216331

push

github

pwelter34
Enable nullable and improve source generators

1403 of 3069 branches covered (45.72%)

Branch coverage included in aggregate %.

527 of 907 new or added lines in 58 files covered. (58.1%)

22 existing lines in 10 files now uncovered.

4288 of 6846 relevant lines covered (62.64%)

330.58 hits per line

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

0.0
/src/FluentCommand.Generators/GenerateAttributeGenerator.cs
1
using FluentCommand.Generators.Models;
2

3
using Microsoft.CodeAnalysis;
4

5
namespace FluentCommand.Generators;
6

7
[Generator(LanguageNames.CSharp)]
8
public class GenerateAttributeGenerator : DataReaderFactoryGenerator, IIncrementalGenerator
9
{
10
    public void Initialize(IncrementalGeneratorInitializationContext context)
11
    {
NEW
12
        var entityClasses = context.SyntaxProvider.ForAttributeWithMetadataName(
×
13
            fullyQualifiedMetadataName: "FluentCommand.Attributes.GenerateReaderAttribute",
×
14
            predicate: SyntacticPredicate,
×
15
            transform: SemanticTransform
×
16
        )
×
NEW
17
        .Where(static context => context.Count > 0)
×
NEW
18
        .SelectMany(static (item, _) => item)
×
NEW
19
        .WithTrackingName("GenerateAttributeGenerator");
×
20

NEW
21
        context.RegisterSourceOutput(entityClasses, WriteDataReaderSource);
×
NEW
22
        context.RegisterSourceOutput(entityClasses, WriteTypeAccessorSource);
×
UNCOV
23
    }
×
24

25
    private static bool SyntacticPredicate(SyntaxNode syntaxNode, CancellationToken cancellationToken)
26
    {
27
        return true;
×
28
    }
29

30
    private static EquatableArray<EntityClass> SemanticTransform(GeneratorAttributeSyntaxContext context, CancellationToken cancellationToken)
31
    {
32
        if (context.Attributes.Length == 0)
×
NEW
33
            return EquatableArray<EntityClass>.Empty;
×
34

35
        var classes = new List<EntityClass>();
×
36

UNCOV
37
        foreach (var attribute in context.Attributes)
×
38
        {
39
            if (attribute == null)
×
NEW
40
                return EquatableArray<EntityClass>.Empty;
×
41

42
            if (attribute.ConstructorArguments.Length != 1)
×
NEW
43
                return EquatableArray<EntityClass>.Empty;
×
44

45
            var comparerArgument = attribute.ConstructorArguments[0];
×
46
            if (comparerArgument.Value is not INamedTypeSymbol targetSymbol)
×
NEW
47
                return EquatableArray<EntityClass>.Empty;
×
48

NEW
49
            var entityClass = CreateClass(targetSymbol);
×
50
            if (entityClass != null)
×
51
                classes.Add(entityClass);
×
52
        }
53

NEW
54
        return classes;
×
55
    }
56
}
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