Skip to content

Commit 0e975e5

Browse files
authored
Merge branch 'main' into dependabot/nuget/src/main/Microsoft.Extensions.DependencyInjection-10.0.0
2 parents 5396cac + 770df22 commit 0e975e5

File tree

5 files changed

+245
-369
lines changed

5 files changed

+245
-369
lines changed

src/Exporters/ConsoleExporter.cs

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,37 @@
66

77
namespace PowerUtils.BenchmarkDotnet.Reporter.Exporters;
88

9-
public sealed class ConsoleExporter(IOHelpers.Printer printer) : IExporter
9+
public sealed class ConsoleExporter : IExporter
1010
{
11-
private readonly IOHelpers.Printer _printer = printer;
12-
1311
public void Generate(ComparerReport report, string outputDirectory)
1412
{
15-
_printer(Environment.NewLine);
16-
_printer("══════════════════════════════════════════════════════════════════════════════════");
17-
_printer(Environment.NewLine);
18-
_printer(" BENCHMARK COMPARISON REPORT");
19-
_printer(Environment.NewLine);
20-
_printer("══════════════════════════════════════════════════════════════════════════════════");
21-
_printer(Environment.NewLine);
22-
_printer(Environment.NewLine);
13+
Console.WriteLine("══════════════════════════════════════════════════════════════════════════════════");
14+
Console.WriteLine(" BENCHMARK COMPARISON REPORT");
15+
Console.WriteLine("══════════════════════════════════════════════════════════════════════════════════");
16+
Console.WriteLine();
2317

2418
if(report.Warnings.Count != 0)
2519
{
26-
_printer("⚠️ WARNINGS:");
27-
_printer(Environment.NewLine);
28-
_printer(Environment.NewLine);
20+
Console.WriteLine("⚠️ WARNINGS:");
21+
Console.WriteLine();
2922

3023
foreach(var warning in report.Warnings)
3124
{
32-
_printer($" • {warning}");
33-
_printer(Environment.NewLine);
25+
Console.WriteLine($" • {warning}");
3426
}
3527

36-
_printer(Environment.NewLine);
37-
_printer(".................................................................................");
38-
_printer(Environment.NewLine);
39-
_printer(Environment.NewLine);
28+
Console.WriteLine();
29+
Console.WriteLine(".................................................................................");
30+
Console.WriteLine();
4031
}
4132

42-
_printer("📊 RESULTS:");
43-
_printer(Environment.NewLine);
44-
_printer(Environment.NewLine);
33+
Console.WriteLine("📊 RESULTS:");
34+
Console.WriteLine();
4535

4636
if(report.Comparisons.Count == 0)
4737
{
48-
_printer(" No comparisons found.");
49-
_printer(Environment.NewLine);
38+
Console.WriteLine(" No comparisons found.");
39+
Console.WriteLine();
5040
}
5141
else
5242
{
@@ -167,30 +157,25 @@ public void Generate(ComparerReport report, string outputDirectory)
167157

168158
foreach(var row in table)
169159
{
170-
_printer(string.Join("", row));
171-
_printer(Environment.NewLine);
160+
Console.WriteLine(string.Join("", row));
172161
}
173162
}
174163

175164
if(report.HitThresholds.Count != 0)
176165
{
177-
_printer(Environment.NewLine);
178-
_printer(".................................................................................");
179-
_printer(Environment.NewLine);
180-
_printer(Environment.NewLine);
181-
_printer("🚨 THRESHOLD VIOLATIONS:");
182-
_printer(Environment.NewLine);
183-
_printer(Environment.NewLine);
166+
Console.WriteLine();
167+
Console.WriteLine(".................................................................................");
168+
Console.WriteLine();
169+
Console.WriteLine("🚨 THRESHOLD VIOLATIONS:");
170+
Console.WriteLine();
184171

185172
foreach(var hit in report.HitThresholds)
186173
{
187-
_printer($" • {hit}");
188-
_printer(Environment.NewLine);
174+
Console.WriteLine($" • {hit}");
189175
}
190176
}
191177

192-
_printer(Environment.NewLine);
193-
_printer("══════════════════════════════════════════════════════════════════════════════════");
194-
_printer(Environment.NewLine);
178+
Console.WriteLine();
179+
Console.WriteLine("══════════════════════════════════════════════════════════════════════════════════");
195180
}
196181
}

src/Helpers/IOHelpers.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ public static class IOHelpers
1010
public const string REPORT_FILE_ENDS = "-report-full.json";
1111

1212

13-
public delegate void Printer(string message);
14-
public static void Print(string message)
15-
=> Console.Write(message);
16-
17-
1813
public delegate void FileWriter(string path, string content);
1914
public static void WriteFile(string path, string content)
2015
{
@@ -26,7 +21,7 @@ public static void WriteFile(string path, string content)
2621

2722
File.WriteAllText(path, content);
2823

29-
Print($"{Environment.NewLine}File exported to: '{path}'");
24+
Console.Write($"{Environment.NewLine}File exported to: '{path}'");
3025
}
3126

3227
public static BenchmarkFullJsonResport[] ReadFullJsonReport(string? path)

src/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
var serviceCollection = new ServiceCollection();
1616
serviceCollection
1717
.AddTransient<ToolCommands>()
18-
.AddTransient<IOHelpers.Printer>(sp =>
19-
(message) => IOHelpers.Print(message))
2018
.AddTransient<IOHelpers.FileWriter>(sp =>
2119
(path, content) => IOHelpers.WriteFile(path, content))
2220
.AddTransient<Func<string?, BenchmarkFullJsonResport[]>>(sp =>

0 commit comments

Comments
 (0)