private object CreateDataGridFriendlyArtifact(Artifact artifact, HotspotCalculator hotspotCalculator, IAliasMapping aliasMapping) { var linesOfCode = (int)hotspotCalculator.GetLinesOfCode(artifact); if (_contributions != null) { var result = new DataGridFriendlyArtifact(); var localFileToContribution = AliasTransformContribution(_contributions, aliasMapping); var key = artifact.LocalPath.ToLowerInvariant(); if (localFileToContribution.ContainsKey(key)) { var contribution = localFileToContribution[key]; var mainDev = contribution.GetMainDeveloper(); // Work related information result.FractalValue = contribution.CalculateFractalValue(); result.MainDev = mainDev.Developer; result.MainDevPercent = mainDev.Percent; } else { result.MainDev = "???"; //Warnings.Add(new WarningMessage("", $"Cannot find contribution for file {key}")); } result.LocalPath = artifact.LocalPath; result.Commits = artifact.Commits; result.Committers = artifact.Committers.Count; result.LOC = linesOfCode; result.WorkItems = artifact.WorkItems.Count; result.CodeAge_Days = (DateTime.Now - artifact.Date).Days; result.Hotspot = hotspotCalculator.GetHotspotValue(artifact); return(result); } else { var result = new DataGridFriendlyArtifactBasic(); result.LocalPath = artifact.LocalPath; result.Commits = artifact.Commits; result.Committers = artifact.Committers.Count; result.LOC = linesOfCode; result.WorkItems = artifact.WorkItems.Count; result.CodeAge_Days = (DateTime.Now - artifact.Date).Days; result.Hotspot = hotspotCalculator.GetHotspotValue(artifact); return(result); } }
object CreateDataGridFriendlyArtifact(Artifact artifact, HotspotCalculator hotspotCalculator) { var linesOfCode = (int)hotspotCalculator.GetArea(artifact); if (_contributions != null) { var result = new DataGridFriendlyArtifact(); var artifactContribution = _contributions[artifact.LocalPath.ToLowerInvariant()]; var mainDev = artifactContribution.GetMainDeveloper(); result.LocalPath = artifact.LocalPath; result.Revision = artifact.Revision; result.Commits = artifact.Commits; result.Committers = artifact.Committers.Count; result.LOC = linesOfCode; result.WorkItems = artifact.WorkItems.Count; result.CodeAge_Days = (DateTime.Now - artifact.Date).Days; result.Hotspot = hotspotCalculator.GetHotspot(artifact); // Work related information result.FractalValue = artifactContribution.CalculateFractalValue(); result.MainDev = mainDev.Developer; result.MainDevPercent = mainDev.Percent; return(result); } else { var result = new DataGridFriendlyArtifactBasic(); result.LocalPath = artifact.LocalPath; result.Revision = artifact.Revision; result.Commits = artifact.Commits; result.Committers = artifact.Committers.Count; result.LOC = linesOfCode; result.WorkItems = artifact.WorkItems.Count; result.CodeAge_Days = (DateTime.Now - artifact.Date).Days; result.Hotspot = hotspotCalculator.GetHotspot(artifact); return(result); } }