Пример #1
0
        public CodeMetricResult Calculate(SyntaxNode node)
        {
            var loc = _locCal.Calculate(node);
            var cc  = _ccCal.Calculate(node);
            var halsteadAnalyzer = new HalsteadAnalyzer();
            var halsteadMetrics  = halsteadAnalyzer.Calculate(node);
            var mi = MaintainabilityIndexCalculator.CalculateMaintainablityIndex(cc, loc, halsteadMetrics);

            return(new CodeMetricResult
            {
                LineOfCode = loc,
                CyclomaticComplexity = cc,
                MaintainabilityIndex = mi
            });
        }
Пример #2
0
 public CodeMetricCalculator()
 {
     _locCal = new LineOfCodeCalculator();
     _ccCal  = new CyclomaticComplexityCalculator();
     _miCal  = new MaintainabilityIndexCalculator();
 }