Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions src/StructuredLogger/Analyzers/DoubleWritesAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -12,7 +12,7 @@ public class DoubleWritesAnalyzer
public static IEnumerable<KeyValuePair<string, HashSet<string>>> GetDoubleWrites(Build build)
{
var analyzer = new DoubleWritesAnalyzer();
build.VisitAllChildren<Task>(task => analyzer.AnalyzeTask(task));
build.VisitAllChildren<Task>(analyzer.AnalyzeTask);
return analyzer.GetDoubleWrites();
}

Expand Down Expand Up @@ -93,26 +93,10 @@ private void ProcessCopy(string source, string destination)
fileCopySourcesForDestination.Add(destination, bucket);
}

bucket.Add(source);
bucket.Add(GetFullPath(source));
}

private static bool IsDoubleWrite(KeyValuePair<string, HashSet<string>> bucket)
{
if (bucket.Value.Count < 2)
{
return false;
}

if (bucket.Value
.Select(f => GetFullPath(f))
.Distinct()
.Count() == 1)
{
return false;
}

return true;
}
private static bool IsDoubleWrite(KeyValuePair<string, HashSet<string>> bucket) => bucket.Value.Count > 1;

private static string GetFullPath(string filePath)
{
Expand Down