Package org.sonar.javascript.metrics
Class ComplexityVisitor
- java.lang.Object
-
- org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor
-
- org.sonar.javascript.metrics.ComplexityVisitor
-
- All Implemented Interfaces:
TreeVisitor
public class ComplexityVisitor extends DoubleDispatchVisitor
-
-
Constructor Summary
Constructors Constructor Description ComplexityVisitor(boolean mustAnalyseNestedFunctions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Tree>complexityTrees(Tree tree)intgetComplexity(Tree tree)voidvisitAccessorMethodDeclaration(AccessorMethodDeclarationTree tree)voidvisitArrowFunction(ArrowFunctionTree tree)voidvisitBinaryExpression(BinaryExpressionTree tree)voidvisitCaseClause(CaseClauseTree tree)voidvisitConditionalExpression(ConditionalExpressionTree tree)voidvisitDoWhileStatement(DoWhileStatementTree tree)voidvisitForObjectStatement(ForObjectStatementTree tree)voidvisitForStatement(ForStatementTree tree)voidvisitFunctionDeclaration(FunctionDeclarationTree tree)voidvisitFunctionExpression(FunctionExpressionTree tree)voidvisitIfStatement(IfStatementTree tree)voidvisitMethodDeclaration(MethodDeclarationTree tree)voidvisitWhileStatement(WhileStatementTree tree)-
Methods inherited from class org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor
getContext, scan, scan, scanChildren, scanTree, visitArgumentList, visitArrayAssignmentPattern, visitArrayBindingPattern, visitArrayLiteral, visitAssignmentExpression, visitAssignmentPatternRestElement, visitBindingProperty, visitBlock, visitBreakStatement, visitCallExpression, visitCatchBlock, visitClass, visitComment, visitComputedPropertyName, visitContinueStatement, visitDebugger, visitDecorator, visitDefaultClause, visitDefaultExportDeclaration, visitElseClause, visitEmptyStatement, visitExportClause, visitExportDefaultBinding, visitExportDefaultBindingWithExportList, visitExportDefaultBindingWithNameSpaceExport, visitExpressionStatement, visitExtendsClause, visitFieldDeclaration, visitFinallyBlock, visitFlowArrayTypeShorthand, visitFlowArrayTypeWithKeywordTree, visitFlowCastingExpression, visitFlowDeclare, visitFlowFunctionSignature, visitFlowFunctionType, visitFlowFunctionTypeParameter, visitFlowFunctionTypeParameterClause, visitFlowGenericParameter, visitFlowGenericParameterClause, visitFlowImplementsClause, visitFlowInterfaceDeclaration, visitFlowIntersectionType, visitFlowLiteralType, visitFlowMethodPropertyDefinitionKey, visitFlowModule, visitFlowModuleExports, visitFlowNamespacedType, visitFlowObjectTypeTree, visitFlowOpaqueType, visitFlowOptionalBindingElement, visitFlowOptionalType, visitFlowParameterizedGenerics, visitFlowParenthesisedType, visitFlowPropertyType, visitFlowPropertyTypeKey, visitFlowSimpleType, visitFlowTupleType, visitFlowTypeAliasStatement, visitFlowTypeAnnotation, visitFlowTypedBindingElement, visitFlowTypeofType, visitFlowUnionType, visitFromClause, visitIdentifier, visitImport, visitImportClause, visitImportDeclaration, visitImportModuleDeclaration, visitInitializedAssignmentPatternElement, visitInitializedBindingElement, visitJsxClosingElement, visitJsxEmptyClosingElement, visitJsxEmptyOpeningElement, visitJsxIdentifier, visitJsxJavaScriptExpression, visitJsxOpeningElement, visitJsxSelfClosingElement, visitJsxShortFragmentElement, visitJsxSpreadAttribute, visitJsxStandardAttribute, visitJsxStandardElement, visitJsxText, visitLabelledStatement, visitLiteral, visitMemberExpression, visitModule, visitNamedExportDeclaration, visitNamedImportExportClause, visitNameSpaceExportDeclaration, visitNameSpaceImport, visitNewExpression, visitNewTarget, visitObjectAssignmentPattern, visitObjectAssignmentPatternPairElement, visitObjectBindingPattern, visitObjectLiteral, visitPairProperty, visitParameterList, visitParenthesisedExpression, visitRestElement, visitReturnStatement, visitScript, visitSpecifier, visitSpreadElement, visitSuper, visitSwitchStatement, visitTaggedTemplate, visitTemplateCharacters, visitTemplateExpression, visitTemplateLiteral, visitThrowStatement, visitToken, visitTryStatement, visitUnaryExpression, visitVariableDeclaration, visitVariableStatement, visitWithStatement, visitYieldExpression
-
-
-
-
Method Detail
-
getComplexity
public int getComplexity(Tree tree)
-
visitMethodDeclaration
public void visitMethodDeclaration(MethodDeclarationTree tree)
- Overrides:
visitMethodDeclarationin classDoubleDispatchVisitor
-
visitAccessorMethodDeclaration
public void visitAccessorMethodDeclaration(AccessorMethodDeclarationTree tree)
- Overrides:
visitAccessorMethodDeclarationin classDoubleDispatchVisitor
-
visitFunctionDeclaration
public void visitFunctionDeclaration(FunctionDeclarationTree tree)
- Overrides:
visitFunctionDeclarationin classDoubleDispatchVisitor
-
visitFunctionExpression
public void visitFunctionExpression(FunctionExpressionTree tree)
- Overrides:
visitFunctionExpressionin classDoubleDispatchVisitor
-
visitArrowFunction
public void visitArrowFunction(ArrowFunctionTree tree)
- Overrides:
visitArrowFunctionin classDoubleDispatchVisitor
-
visitIfStatement
public void visitIfStatement(IfStatementTree tree)
- Overrides:
visitIfStatementin classDoubleDispatchVisitor
-
visitWhileStatement
public void visitWhileStatement(WhileStatementTree tree)
- Overrides:
visitWhileStatementin classDoubleDispatchVisitor
-
visitDoWhileStatement
public void visitDoWhileStatement(DoWhileStatementTree tree)
- Overrides:
visitDoWhileStatementin classDoubleDispatchVisitor
-
visitForStatement
public void visitForStatement(ForStatementTree tree)
- Overrides:
visitForStatementin classDoubleDispatchVisitor
-
visitForObjectStatement
public void visitForObjectStatement(ForObjectStatementTree tree)
- Overrides:
visitForObjectStatementin classDoubleDispatchVisitor
-
visitCaseClause
public void visitCaseClause(CaseClauseTree tree)
- Overrides:
visitCaseClausein classDoubleDispatchVisitor
-
visitConditionalExpression
public void visitConditionalExpression(ConditionalExpressionTree tree)
- Overrides:
visitConditionalExpressionin classDoubleDispatchVisitor
-
visitBinaryExpression
public void visitBinaryExpression(BinaryExpressionTree tree)
- Overrides:
visitBinaryExpressionin classDoubleDispatchVisitor
-
-