Exemplo n.º 1
0
            internal static void EvaluateComplexityMetrics(ICSharpCode.OldNRefactory.Ast.INode method, MethodProperties props)
            {
                props.CyclometricComplexity = 1;
                props.LOCReal           = 0;
                props.NumberOfVariables = 0;

                cls = props.ParentClass;

                ASTVisitor ctxAstVisitor = new ASTVisitor();

                if (method is MethodDeclaration)
                {
                    foreach (var statement in ((MethodDeclaration)method).Body.Children)
                    {
                        ctxAstVisitor.VisitStatement(statement, props);
                    }
                }
                else if (method is ConstructorDeclaration)
                {
                    foreach (var statement in ((ConstructorDeclaration)method).Body.Children)
                    {
                        ctxAstVisitor.VisitStatement(statement, props);
                    }
                }
                cls.CyclometricComplexity += props.CyclometricComplexity;
            }
			internal static void EvaluateComplexityMetrics (ICSharpCode.NRefactory.Ast.INode method, MethodProperties props)
			{
				props.CyclometricComplexity = 1;
				props.LOCReal=0;
				props.NumberOfVariables=0;
				
				cls = props.ParentClass;
				
				ASTVisitor ctxAstVisitor = new ASTVisitor();
				if(method is MethodDeclaration) {
					foreach (var statement in ((MethodDeclaration)method).Body.Children) {
						ctxAstVisitor.VisitStatement(statement, props);
					}
				} else if (method is ConstructorDeclaration) {
					foreach (var statement in ((ConstructorDeclaration)method).Body.Children) {
						ctxAstVisitor.VisitStatement(statement, props);
					}
				}
				cls.CyclometricComplexity += props.CyclometricComplexity;
			}