Пример #1
0
        public void CalculateMethodMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls,
                                           MethodMetrics mtdMetrics, MethodDeclarationSyntax mtd, SemanticModel sclsmodel)
        {
            LocRule loc = new LocRule();

            mtdMetrics.Loc = loc.GetLocCount(mtd);
        }
        public void CalculateMethodMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls,
                                           MethodMetrics mtdMetrics, MethodDeclarationSyntax mtd, SemanticModel sclsmodel)
        {
            CyclomaticComplexityRule cc = new CyclomaticComplexityRule();

            mtdMetrics.CyclomaticComplexity = cc.Calculate(mtd, sclsmodel);
        }
Пример #3
0
        public void Calculate(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls)
        {
            SemanticModel smtdmodel = prj.CompiledProject.GetSemanticModel(cls.ClassDeclarationSyntax.SyntaxTree);

            foreach (var mtd in cls.Methods)
            {
                MethodMetrics mtdMetrics = new MethodMetrics();
                foreach (var rule in _rulesList)
                {
                    rule.CalculateMethodMetrics(prj, clsMetrics, cls, mtdMetrics, mtd.MethodDeclarationSyntax, smtdmodel);
                }
                clsMetrics.MethodMetricses.Add(mtdMetrics);
            }
        }
Пример #4
0
 public void CalculateMethodMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls,
                                    MethodMetrics mtdMetrics, MethodDeclarationSyntax mtd, SemanticModel sclsmodel)
 {
     Rule.MethodparametersRule mtdprmrule = new Rule.MethodparametersRule();
     mtdMetrics.Methodparameters = mtdprmrule.GetMethodparametersCount(mtd);
 }