init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<PackAsTool>true</PackAsTool>
|
||||
<ToolCommandName>codecoverageextractor2</ToolCommandName>
|
||||
<PackageOutputPath>./nupkg</PackageOutputPath>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageId>codecoverageextractor2</PackageId>
|
||||
<Authors>Monster1025</Authors>
|
||||
<Company>admin@yandex5.ru</Company>
|
||||
<Product>Code Coverage Extractor</Product>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Xml;
|
||||
|
||||
try
|
||||
{
|
||||
if (!args.Any())
|
||||
{
|
||||
Console.WriteLine("No file specified");
|
||||
return;
|
||||
}
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(args[0]);
|
||||
|
||||
var coverage = doc.SelectSingleNode("/coverage/@line-rate")!.Value;
|
||||
if (decimal.TryParse(coverage, out var dCoverage))
|
||||
{
|
||||
var format = args.Length > 1 ? args[1] : "total_coverage={0}";
|
||||
Console.WriteLine(string.Format(format, dCoverage * 100));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Value could not be extracted");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"An error occurred: {ex.Message}");
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user