示例#1
0
        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);
            }
        }
示例#2
0
        protected override string GetDescription(Artifact item)
        {
            var hotspot = _hotspotCalculator.GetHotspotValue(item);

            return(item.ServerPath
                   + "\nCommits: "
                   + item.Commits + "\nLOC: "
                   + _hotspotCalculator.GetLinesOfCode(item) + "\nHotspot: "
                   + hotspot.ToString("F5", CultureInfo.InvariantCulture));
        }