dotnet / dotnet/BenchmarkDotNet

Question about IColumn.GetValue(..) and SummaryStyle

Open
#1,784 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C#
Stars
11.5k
Forks
1.1k
Avg merge
6d 11h
Merged PRs (30d)
12

Description

I'm confused by this description of IColumn.GetValue():
https://github.com/dotnet/BenchmarkDotNet/blob/93786511bf9b2a0e2bdae45c7248ff963a750992/src/BenchmarkDotNet/Columns/IColumn.cs#L19-L27

Now my reading would be to implement this as:
```C#
public string GetValue(Summary summary, BenchmarkCase benchmarkCase) => GetValue(summary, benchmarkCase, summary.Style);
public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style) => ValueWithStyle(style);
```
But most actual implementations do it the other way around:
```C#
public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
{
if (someColumn)
{
// Some use the maybe user-defined style of the summary or don't need one
return ValueWithStyle(summary.Style);
}
else
{
// Others ignore any user-defined style and use the predefined default
return ValueWithStyle(SummaryStyle.Default);
}
}
// While this overload in most cases ignores the explicit style parameter
public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style) => GetValue(summary, benchmarkCase);
```

So what am I missing here?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.