< Summary

Information
Class: DirectSight.CommandLineArgumentNames
Assembly DirectSight
File(s): /home/runner/work/DirectSight/DirectSight/DirectSight/CommandLineArgumentNames.cs
Line coverage
83%
Covered lines: 10
Uncovered lines: 2
Coverable lines: 12
Total lines: 54
Line coverage: 83.3%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.cctor()100%11100%
IsValid(...)50%2266.66%

File(s)

/home/runner/work/DirectSight/DirectSight/DirectSight/CommandLineArgumentNames.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.Text.RegularExpressions;
 3
 4namespace DirectSight;
 5
 6/// <summary>
 7/// Name of the command line arguments.
 8/// </summary>
 9internal static class CommandLineArgumentNames
 10{
 11    /// <summary>
 12    /// The reports.
 13    /// </summary>
 14    public const string Reports = "reports";
 15
 16    /// <summary>
 17    /// The target directory.
 18    /// </summary>
 19    public const string TargetDirectory = "targetdir";
 20
 21    /// <summary>
 22    /// Whether or not to run the test in debugging mode (more verbose logging)
 23    /// </summary>
 24    public const string DebugMode = "debug";
 25
 26    /// <summary>
 27    /// All valid command line parameter names.
 28    /// </summary>
 129    private static readonly HashSet<string> ValidNames = [
 130        DebugMode,
 131        Reports,
 132        TargetDirectory
 133        ];
 34
 35    /// <summary>
 36    /// Gets the regex to parse command line parameters.
 37    /// </summary>
 1038    internal static Regex CommandLineParameterRegex { get; } = new Regex("^-(?<key>[a-z]{5,}):(?<value>.+)$", RegexOptio
 39
 40    /// <summary>
 41    /// Gets a value indicating whether a command line parameter name is valid.
 42    /// </summary>
 43    /// <param name="name">The command line parameter name.</param>
 44    /// <returns><c>true</c> if command line parameter is valid; otherwise <c>false</c>.</returns>
 45    public static bool IsValid(string name)
 946    {
 947        if (name == null)
 048        {
 049            return false;
 50        }
 51
 952        return ValidNames.Contains(name);
 953    }
 54}