Exemple #1
0
 private static void AnalyzePropertie(ProjectAnalysisData prj, ClassAnalysisData cls, ClassMetrics clsMetrics)
 {
     foreach (var prop in cls.Properties)
     {
         break;
     }
 }
        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);
            }
        }
Exemple #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);
            }
        }
        public IList <ClassAnalysisData> Analysis(Compilation compiledProject)
        {
            var result  = new List <ClassAnalysisData>();
            var classes = _modelListGetter.GetModelList(compiledProject);

            foreach (var item in classes)
            {
                var mtdModelList = _methodAnalyser.Analyze(item);
                var classModel   = new ClassAnalysisData
                {
                    ClassDeclarationSyntax = item,
                    Methods   = mtdModelList.ToList(),
                    Namespace = _namespaceAnalyser.Analyse(item)
                };
                result.Add(classModel);
            }
            return(result);
        }
        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 CalculateClassMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls,
                                          SemanticModel sclsmodel)
        {
            CyclomaticComplexityRule cc = new CyclomaticComplexityRule();

            clsMetrics.CyclomaticComplexity = cc.Calculate(cls.ClassDeclarationSyntax, sclsmodel);
        }
Exemple #7
0
        public void CalculateClassMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls, SemanticModel sclsmodel)
        {
            DepthOfInheritanceRule depthOfInheritance = new DepthOfInheritanceRule(sclsmodel);

            clsMetrics.DOI = depthOfInheritance.Calculate(cls.ClassDeclarationSyntax);
        }
Exemple #8
0
        public void CalculateClassMetrics(ProjectAnalysisData prj, ClassMetrics clsMetrics, ClassAnalysisData cls,
                                          SemanticModel sclsmodel)
        {
            LocRule loc = new LocRule();

            clsMetrics.Loc = loc.GetLocCount(cls.ClassDeclarationSyntax);
        }
Exemple #9
0
        private static void AnalyzeMethod(ProjectAnalysisData prj, ClassAnalysisData cls, ClassMetrics clsMetrics)
        {
            MethodMetricscalculator mmc = new MethodMetricscalculator();

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

            calculate.Calculate(prj, clsMetrics, cls);
        }
        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);
        }
Exemple #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);
 }