< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Utilities.Yaml.BuilderUtils
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Utilities/Yaml/BuilderUtils.cs
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
87%
Covered lines: 14
Uncovered lines: 2
Coverable lines: 16
Total lines: 56
Line coverage: 87.5%
Branch coverage
87%
Covered branches: 7
Total branches: 8
Branch coverage: 87.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 10/13/2025 - 16:52:37 Line coverage: 87.5% (14/16) Branch coverage: 87.5% (7/8) Total lines: 56 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e 10/13/2025 - 16:52:37 Line coverage: 87.5% (14/16) Branch coverage: 87.5% (7/8) Total lines: 56 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
BuildSerializer(...)87.5%8887.5%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Utilities/Yaml/BuilderUtils.cs

#LineLine coverage
 1using YamlDotNet.Serialization;
 2
 3namespace Kestrun.Utilities.Yaml;
 4
 5/// <summary>
 6/// Utility class for building YAML serializers with common settings
 7/// </summary>
 8public class BuilderUtils
 9{
 10    /// <summary>
 11    /// Builds a YamlDotNet ISerializerBuilder with common settings.
 12    /// </summary>
 13    /// <param name="builder">The serializer builder to configure.</param>
 14    /// <param name="omitNullValues">Whether to omit null values.</param>
 15    /// <param name="useFlowStyle">Whether to use flow style for collections.</param>
 16    /// <param name="useSequenceFlowStyle">Whether to use flow style for sequences.</param>
 17    /// <param name="jsonCompatible">Whether to make the output JSON compatible.</param>
 18    /// <returns>The configured serializer builder.</returns>
 19    public static SerializerBuilder BuildSerializer(
 20        SerializerBuilder builder,
 21        bool omitNullValues = false,
 22        bool useFlowStyle = false,
 23        bool useSequenceFlowStyle = false,
 24        bool jsonCompatible = false)
 25    {
 2126        if (jsonCompatible)
 27        {
 028            useFlowStyle = true;
 029            useSequenceFlowStyle = true;
 30        }
 31
 2132        builder = builder
 2133            .WithEventEmitter(next => new StringQuotingEmitter(next))
 2134            .WithTypeConverter(new BigIntegerTypeConverter())
 2135            .WithTypeConverter(new IDictionaryTypeConverter(omitNullValues, useFlowStyle))
 2136            .WithTypeConverter(new PSObjectTypeConverter(omitNullValues, useFlowStyle));
 37        // Use platform newline; tests explicitly reference [Environment]::NewLine for single-line cases and replace it 
 38        //.WithNewLine("\n");
 39
 2140        if (omitNullValues)
 41        {
 242            builder = builder
 743                .WithEmissionPhaseObjectGraphVisitor(args => new NullValueGraphVisitor(args.InnerVisitor));
 44        }
 2145        if (useFlowStyle)
 46        {
 647            builder = builder.WithEventEmitter(next => new FlowStyleAllEmitter(next));
 48        }
 2149        if (useSequenceFlowStyle)
 50        {
 451            builder = builder.WithEventEmitter(next => new FlowStyleSequenceEmitter(next));
 52        }
 53
 2154        return builder;
 55    }
 56}