< Summary

Information
Class: Hertzole.ScriptableValues.Generator.DocumentationHelper
Assembly: Hertzole.ScriptableValues.Generator
File(s): Generator/Hertzole.ScriptableValues.Generator/Helpers/DocumentationHelper.cs
Tag: 52_28197466029
Line coverage
86%
Covered lines: 19
Uncovered lines: 3
Coverable lines: 22
Total lines: 71
Line coverage: 86.3%
Branch coverage
78%
Covered branches: 11
Total branches: 14
Branch coverage: 78.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
GetMethodCallbackDescription(...)83.33%6691.66%
GetOldValueDescription(...)75%4480%
GetNewValueDescription(...)75%4480%

File(s)

Generator/Hertzole.ScriptableValues.Generator/Helpers/DocumentationHelper.cs

#LineLine coverage
 1using System;
 2
 3namespace Hertzole.ScriptableValues.Generator;
 4
 5internal static class DocumentationHelper
 6{
 7    public const string EVENT_SENDER = "The object that sent the event.";
 8    public const string EVENT_ARGS = "The event arguments.";
 9
 10    public const string COLLECTION_ARGS = "The collection changed arguments.";
 11
 12    public const string POOL_ACTION = "The change that just happened on the pool.";
 13    public const string POOL_ITEM = "The item that was affected by the change.";
 14
 15    public const string SUBSCRIBED_MASK_SUMMARY = "/// <summary>A bitmask of all the possible subscribed callbacks.</sum
 16
 17    public static ReadOnlySpan<char> GetMethodCallbackDescription(in ReadOnlySpan<char> name, in CallbackType callbackTy
 18    {
 4819        using (ArrayBuilder<char> builder = new ArrayBuilder<char>(64))
 20        {
 4821            builder.AddRange("/// <summary>Called when <see cref=\"");
 4822            builder.AddRange(name);
 4823            builder.AddRange("\" /> is ");
 4824            if (callbackType == CallbackType.Event)
 25            {
 026                builder.AddRange("invoked");
 27            }
 4828            else if (callbackType == CallbackType.Value && (flags & CallbackFlags.PreInvoke) != 0)
 29            {
 1630                builder.AddRange("changing");
 31            }
 32            else
 33            {
 3234                builder.AddRange("changed");
 35            }
 36
 4837            builder.AddRange(".</summary>");
 4838            return builder.AsSpan();
 39        }
 4840    }
 41
 42    public static string GetOldValueDescription(in CallbackFlags flags)
 43    {
 4844        if ((flags & CallbackFlags.PreInvoke) != 0)
 45        {
 1646            return "The previous value that is being replaced.";
 47        }
 48
 3249        if ((flags & CallbackFlags.PostInvoke) != 0)
 50        {
 3251            return "The previous value that was replaced.";
 52        }
 53
 054        return $"UNKNOWN FLAG VALUE: {flags}";
 55    }
 56
 57    public static string GetNewValueDescription(in CallbackFlags flags)
 58    {
 4859        if ((flags & CallbackFlags.PreInvoke) != 0)
 60        {
 1661            return "The new value being set.";
 62        }
 63
 3264        if ((flags & CallbackFlags.PostInvoke) != 0)
 65        {
 3266            return "The new value that was set.";
 67        }
 68
 069        return $"UNKNOWN FLAG VALUE: {flags}";
 70    }
 71}