示例#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);
        }
示例#2
0
        public void CalculateClassMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls,
                                          SemanticModel sclsmodel)
        {
            LocRule loc = new LocRule();

            clsMetrics.Loc = loc.GetLocCount(cls.ClassDeclarationSyntax);
        }
        public void CalculateClassMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls,
                                          SemanticModel sclsmodel)
        {
            CyclomaticComplexityRule cc = new CyclomaticComplexityRule();

            clsMetrics.CyclomaticComplexity = cc.Calculate(cls.ClassDeclarationSyntax, sclsmodel);
        }
        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);
        }
示例#5
0
 public void AnalyzeClass(ProjectAnalysisData prj, ProjectMetrics metrics)
 {
     foreach (var cls in prj.Classes)
     {
         ClassMetrics clsMetrics = new ClassMetrics();
         CalculateClassMetrics(prj, clsMetrics, cls);
         AnalyzeMethod(prj, cls, clsMetrics);
         AnalyzePropertie(prj, cls, clsMetrics);
         metrics.ClassMetrics.Add(clsMetrics);
     }
 }
        public void Calculate(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls)
        {
            clsMetrics.Classname     = cls.ClassDeclarationSyntax.Identifier.ValueText;
            clsMetrics.Classdocpath  = cls.ClassDeclarationSyntax.SyntaxTree.FilePath;
            clsMetrics.Namespacename = cls.Namespace.Namespacedeclaration.Name.ToString();
            SemanticModel sclsmodel = prj.CompiledProject.GetSemanticModel(cls.ClassDeclarationSyntax.SyntaxTree);

            foreach (var rule in _rulesList)
            {
                rule.CalculateClassMetrics(prj, clsMetrics, cls, sclsmodel);
            }
        }
示例#7
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);
            }
        }
示例#8
0
        public void CalculateClassMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls, SemanticModel sclsmodel)
        {
            DepthOfInheritanceRule depthOfInheritance = new DepthOfInheritanceRule(sclsmodel);

            clsMetrics.DOI = depthOfInheritance.Calculate(cls.ClassDeclarationSyntax);
        }
示例#9
0
        private static void AnalyzeMethod(ProjectAnalysisData prj, ClassAnalysisData cls, ClassMetrics clsMetrics)
        {
            MethodMetricscalculator mmc = new MethodMetricscalculator();

            mmc.Calculate(prj, clsMetrics, cls);
        }
示例#10
0
        private static void CalculateClassMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls)
        {
            ClassMetricscalculator calculate = new ClassMetricscalculator();

            calculate.Calculate(prj, clsMetrics, cls);
        }
示例#11
0
 private static void AnalyzePropertie(ProjectAnalysisData prj, ClassAnalysisData cls, ClassMetrics clsMetrics)
 {
     foreach (var prop in cls.Properties)
     {
         break;
     }
 }
示例#12
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);
 }