예제 #1
0
        public void FinalizeSelf(MetricsAccumulationNode node)
        {
            int assignmentCount;
            int branchCount;
            int callCount;

            node.TryGetDataItem <int>(AssignmentCount, out assignmentCount);
            node.TryGetDataItem <int>(BranchingCount, out branchCount);
            node.TryGetDataItem <int>(CallCount, out callCount);
            var ABCScore = Math.Sqrt(Math.Pow(assignmentCount, 2) + Math.Pow(branchCount, 2) + Math.Pow(callCount, 2));

            node.SetDataItem <double>(ABCScoreAccumulator, ABCScore);

            if (node.children.Count > 0)
            {
                var ABCWithChildren = ABCScore;
                foreach (MetricsAccumulationNode child in node.children)
                {
                    double ABCScoreForChildren = 0;
                    if (child.TryGetDataItem <double>(ABCScoreWithChildrenAccumulator, out ABCScoreForChildren) ||
                        child.TryGetDataItem <double>(ABCScoreAccumulator, out ABCScoreForChildren))
                    {
                        ABCWithChildren += ABCScoreForChildren;
                    }
                }
                node.SetDataItem <double>(ABCScoreWithChildrenAccumulator, ABCWithChildren);
            }
        }
예제 #2
0
        public void FinalizeSelf(MetricsAccumulationNode node)
        {
            int totalComplexity;

            node.TryGetDataItem <int>(CyclomaticComplexityeData, out totalComplexity);
            foreach (MetricsAccumulationNode child in node.children)
            {
                int childComplexity = 0;
                if (child.TryGetDataItem <int>(TotalCyclomaticComplexityData, out childComplexity) ||
                    child.TryGetDataItem <int>(CyclomaticComplexityeData, out childComplexity))
                {
                    totalComplexity += childComplexity;
                }
            }
            node.SetDataItem <int>(TotalCyclomaticComplexityData, totalComplexity);
        }
        public void FinalizeSelf(MetricsAccumulationNode node)
        {
            int totalLinesOfCode = 0;

            node.TryGetDataItem <int>(LinesOfCodeData, out totalLinesOfCode);
            foreach (MetricsAccumulationNode child in node.children)
            {
                int childLinesOfCode = 0;
                if (child.TryGetDataItem <int>(TotalLinesOfCodeData, out childLinesOfCode) ||
                    child.TryGetDataItem <int>(LinesOfCodeData, out childLinesOfCode))
                {
                    totalLinesOfCode += childLinesOfCode;
                }
                continue;
            }
            node.SetDataItem <int>(TotalLinesOfCodeData, totalLinesOfCode);
        }