Skip to content

Commit

Permalink
Try to remove unescaped pipe characters in table cells
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan committed Jun 20, 2024
1 parent 5bb3103 commit 07b692b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Runner/BenchmarkLibrariesJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,15 @@ await RunProcessAsync("dotnet",
if (line.StartsWith("Job-"))
line = " " + line;

// Workaround for BDN's bug: https://github.com/dotnet/BenchmarkDotNet/issues/2545
if (line.EndsWith(":|-"))
line = line.Remove(line.Length - 1);
if (line.Contains('|'))
{
// Workaround for BDN's bug: https://github.com/dotnet/BenchmarkDotNet/issues/2545
if (line.EndsWith(":|-"))
line = line.Remove(line.Length - 1);

line = PipeCharInTableCellRegex().Replace(line, static match =>
$"{match.Groups[1].ValueSpan}\\|{match.Groups[2].ValueSpan}");
}

line = line.Replace("/artifacts-main/corerun", "Main");
line = line.Replace("/artifacts-pr/corerun", "PR");
Expand Down Expand Up @@ -220,4 +226,9 @@ await RunProcessAsync("dotnet",
// we want 'MihaZupan/performance' and optionally 'regex'
[GeneratedRegex(@"https://github\.com/([A-Za-z\d-_]+/[A-Za-z\d-_]+)(?:/(?:tree|blob)/([A-Za-z\d-_]+)(?:[\?#/].*)?)?", RegexOptions.IgnoreCase | RegexOptions.Singleline)]
private static partial Regex GitHubBranchRegex();

// | Count | Main | (?i)Sher[a-z]+|Hol[a-z]+ |
// We want '+|H' to replace it with '+\|H'
[GeneratedRegex(@"([^ \n:\\])\|([^ \n:])")]
private static partial Regex PipeCharInTableCellRegex();
}

0 comments on commit 07b692b

Please sign in to comment.