Package org.sonar.java.ast.visitors
Class CognitiveComplexityVisitor
- java.lang.Object
-
- org.sonar.plugins.java.api.tree.BaseTreeVisitor
-
- org.sonar.java.ast.visitors.CognitiveComplexityVisitor
-
- All Implemented Interfaces:
TreeVisitor
public class CognitiveComplexityVisitor extends BaseTreeVisitor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CognitiveComplexityVisitor.Result
Cognitive complexity and associated locations
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
compilationUnitComplexity(CompilationUnitTree cut)
static CognitiveComplexityVisitor.Result
methodComplexity(MethodTree methodTree)
void
visitBinaryExpression(BinaryExpressionTree tree)
void
visitBreakStatement(BreakStatementTree tree)
void
visitClass(ClassTree tree)
void
visitConditionalExpression(ConditionalExpressionTree tree)
void
visitContinueStatement(ContinueStatementTree tree)
void
visitDoWhileStatement(DoWhileStatementTree tree)
void
visitForEachStatement(ForEachStatement tree)
void
visitForStatement(ForStatementTree tree)
void
visitIfStatement(IfStatementTree tree)
void
visitLambdaExpression(LambdaExpressionTree lambdaExpressionTree)
void
visitSwitchStatement(SwitchStatementTree tree)
void
visitTryStatement(TryStatementTree tree)
void
visitWhileStatement(WhileStatementTree tree)
-
Methods inherited from class org.sonar.plugins.java.api.tree.BaseTreeVisitor
scan, scan, scan, visitAnnotation, visitArrayAccessExpression, visitArrayDimension, visitArrayType, visitAssertStatement, visitAssignmentExpression, visitBlock, visitCaseGroup, visitCaseLabel, visitCatch, visitCompilationUnit, visitEmptyStatement, visitEnumConstant, visitExportsDirectiveTree, visitExpressionStatement, visitIdentifier, visitImport, visitInstanceOf, visitLabeledStatement, visitLiteral, visitMemberSelectExpression, visitMethod, visitMethodInvocation, visitMethodReference, visitModifier, visitModule, visitNewArray, visitNewClass, visitOpensDirective, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvidesDirective, visitRequiresDirectiveTree, visitReturnStatement, visitSynchronizedStatement, visitThrowStatement, visitTypeArguments, visitTypeCast, visitTypeParameter, visitTypeParameters, visitUnaryExpression, visitUnionType, visitUsesDirective, visitVariable, visitVarType, visitWildcard
-
-
-
-
Method Detail
-
methodComplexity
public static CognitiveComplexityVisitor.Result methodComplexity(MethodTree methodTree)
-
compilationUnitComplexity
public static int compilationUnitComplexity(CompilationUnitTree cut)
-
visitIfStatement
public void visitIfStatement(IfStatementTree tree)
- Specified by:
visitIfStatement
in interfaceTreeVisitor
- Overrides:
visitIfStatement
in classBaseTreeVisitor
-
visitTryStatement
public void visitTryStatement(TryStatementTree tree)
- Specified by:
visitTryStatement
in interfaceTreeVisitor
- Overrides:
visitTryStatement
in classBaseTreeVisitor
-
visitForStatement
public void visitForStatement(ForStatementTree tree)
- Specified by:
visitForStatement
in interfaceTreeVisitor
- Overrides:
visitForStatement
in classBaseTreeVisitor
-
visitForEachStatement
public void visitForEachStatement(ForEachStatement tree)
- Specified by:
visitForEachStatement
in interfaceTreeVisitor
- Overrides:
visitForEachStatement
in classBaseTreeVisitor
-
visitWhileStatement
public void visitWhileStatement(WhileStatementTree tree)
- Specified by:
visitWhileStatement
in interfaceTreeVisitor
- Overrides:
visitWhileStatement
in classBaseTreeVisitor
-
visitDoWhileStatement
public void visitDoWhileStatement(DoWhileStatementTree tree)
- Specified by:
visitDoWhileStatement
in interfaceTreeVisitor
- Overrides:
visitDoWhileStatement
in classBaseTreeVisitor
-
visitConditionalExpression
public void visitConditionalExpression(ConditionalExpressionTree tree)
- Specified by:
visitConditionalExpression
in interfaceTreeVisitor
- Overrides:
visitConditionalExpression
in classBaseTreeVisitor
-
visitSwitchStatement
public void visitSwitchStatement(SwitchStatementTree tree)
- Specified by:
visitSwitchStatement
in interfaceTreeVisitor
- Overrides:
visitSwitchStatement
in classBaseTreeVisitor
-
visitBreakStatement
public void visitBreakStatement(BreakStatementTree tree)
- Specified by:
visitBreakStatement
in interfaceTreeVisitor
- Overrides:
visitBreakStatement
in classBaseTreeVisitor
-
visitContinueStatement
public void visitContinueStatement(ContinueStatementTree tree)
- Specified by:
visitContinueStatement
in interfaceTreeVisitor
- Overrides:
visitContinueStatement
in classBaseTreeVisitor
-
visitClass
public void visitClass(ClassTree tree)
- Specified by:
visitClass
in interfaceTreeVisitor
- Overrides:
visitClass
in classBaseTreeVisitor
-
visitLambdaExpression
public void visitLambdaExpression(LambdaExpressionTree lambdaExpressionTree)
- Specified by:
visitLambdaExpression
in interfaceTreeVisitor
- Overrides:
visitLambdaExpression
in classBaseTreeVisitor
-
visitBinaryExpression
public void visitBinaryExpression(BinaryExpressionTree tree)
- Specified by:
visitBinaryExpression
in interfaceTreeVisitor
- Overrides:
visitBinaryExpression
in classBaseTreeVisitor
-
-