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); }
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); }