Пример #1
0
        private static int CalculateCyclomaticComplexity(this IMethodDefinition method, PdbReader pdb, IMetadataHost host)
        {
            var methodBody = method.Decompile(pdb, host);
            var cyclomaticComplexityCalculator = new CyclomaticComplexityCalculator();

            cyclomaticComplexityCalculator.Traverse(methodBody.Statements());
            return(cyclomaticComplexityCalculator.Result);
        }
Пример #2
0
        private static int CalculateStatements(this IMethodDefinition method, PdbReader pdb, IMetadataHost host)
        {
            var methodBody         = method.Decompile(pdb, host);
            var statementCollector = new StatementCollector(pdb);

            statementCollector.Traverse(methodBody.Statements());
            return(statementCollector.ResultCount);
        }