• 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/TableAttributeGenerator.cs
1
using FluentCommand.Generators.Models;
2

3
using Microsoft.CodeAnalysis;
4
using Microsoft.CodeAnalysis.CSharp;
5
using Microsoft.CodeAnalysis.CSharp.Syntax;
6

7
namespace FluentCommand.Generators;
8

9
[Generator(LanguageNames.CSharp)]
10
public class TableAttributeGenerator : DataReaderFactoryGenerator, IIncrementalGenerator
11
{
12
    public void Initialize(IncrementalGeneratorInitializationContext context)
13
    {
NEW
14
        var entityClasses = context.SyntaxProvider.ForAttributeWithMetadataName(
×
15
            fullyQualifiedMetadataName: "System.ComponentModel.DataAnnotations.Schema.TableAttribute",
×
16
            predicate: SyntacticPredicate,
×
17
            transform: SemanticTransform
×
18
        )
×
NEW
19
        .Where(static context => context is not null)
×
NEW
20
        .Select(static (context, _) => context!)
×
NEW
21
        .WithTrackingName("TableAttributeGenerator");
×
22

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

27
    private static bool SyntacticPredicate(SyntaxNode syntaxNode, CancellationToken cancellationToken)
28
    {
NEW
29
        return
×
NEW
30
            (
×
NEW
31
                syntaxNode is ClassDeclarationSyntax { AttributeLists.Count: > 0 } classDeclaration
×
NEW
32
                    && !classDeclaration.Modifiers.Any(SyntaxKind.AbstractKeyword)
×
NEW
33
                    && !classDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword)
×
NEW
34
            )
×
NEW
35
            ||
×
NEW
36
            (
×
NEW
37
                syntaxNode is RecordDeclarationSyntax { AttributeLists.Count: > 0 } recordDeclaration
×
NEW
38
                    && !recordDeclaration.Modifiers.Any(SyntaxKind.AbstractKeyword)
×
NEW
39
                    && !recordDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword)
×
NEW
40
            );
×
41
    }
42

43
    private static EntityClass? SemanticTransform(GeneratorAttributeSyntaxContext context, CancellationToken cancellationToken)
44
    {
45
        if (context.TargetSymbol is not INamedTypeSymbol targetSymbol)
×
46
            return null;
×
47

NEW
48
        return CreateClass(targetSymbol);
×
49
    }
50
}
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