Package org.sonar.javascript.metrics
Class CognitiveComplexity
- java.lang.Object
-
- org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor
-
- org.sonar.javascript.metrics.CognitiveComplexity
-
- All Implemented Interfaces:
TreeVisitor
public class CognitiveComplexity extends DoubleDispatchVisitor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCognitiveComplexity.ComplexityData
-
Constructor Summary
Constructors Constructor Description CognitiveComplexity()CognitiveComplexity(int declarationNestingLevel)
-
Method Summary
-
Methods inherited from class org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor
getContext, scan, scan, scanChildren, scanTree, visitArgumentList, visitArrayAssignmentPattern, visitArrayBindingPattern, visitArrayLiteral, visitAssignmentExpression, visitAssignmentPatternRestElement, visitBindingProperty, visitBlock, visitCallExpression, visitCaseClause, visitClass, visitComment, visitComputedPropertyName, visitDebugger, visitDecorator, visitDefaultClause, visitDefaultExportDeclaration, 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, visitTaggedTemplate, visitTemplateCharacters, visitTemplateExpression, visitTemplateLiteral, visitThrowStatement, visitToken, visitTryStatement, visitUnaryExpression, visitVariableDeclaration, visitVariableStatement, visitWithStatement, visitYieldExpression
-
-
-
-
Method Detail
-
calculateFunctionComplexity
public CognitiveComplexity.ComplexityData calculateFunctionComplexity(FunctionTree functionTree, boolean definesModule)
-
calculateScriptComplexity
public CognitiveComplexity.ComplexityData calculateScriptComplexity(ScriptTree tree)
-
clear
public void clear()
-
visitIfStatement
public void visitIfStatement(IfStatementTree tree)
- Overrides:
visitIfStatementin classDoubleDispatchVisitor
-
visitElseClause
public void visitElseClause(ElseClauseTree tree)
- Overrides:
visitElseClausein 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
-
visitCatchBlock
public void visitCatchBlock(CatchBlockTree tree)
- Overrides:
visitCatchBlockin classDoubleDispatchVisitor
-
visitSwitchStatement
public void visitSwitchStatement(SwitchStatementTree tree)
- Overrides:
visitSwitchStatementin classDoubleDispatchVisitor
-
visitBinaryExpression
public void visitBinaryExpression(BinaryExpressionTree tree)
- Overrides:
visitBinaryExpressionin classDoubleDispatchVisitor
-
visitConditionalExpression
public void visitConditionalExpression(ConditionalExpressionTree tree)
- Overrides:
visitConditionalExpressionin classDoubleDispatchVisitor
-
visitBreakStatement
public void visitBreakStatement(BreakStatementTree tree)
- Overrides:
visitBreakStatementin classDoubleDispatchVisitor
-
visitContinueStatement
public void visitContinueStatement(ContinueStatementTree tree)
- Overrides:
visitContinueStatementin classDoubleDispatchVisitor
-
visitFunctionDeclaration
public void visitFunctionDeclaration(FunctionDeclarationTree tree)
- Overrides:
visitFunctionDeclarationin classDoubleDispatchVisitor
-
visitArrowFunction
public void visitArrowFunction(ArrowFunctionTree tree)
- Overrides:
visitArrowFunctionin classDoubleDispatchVisitor
-
visitFunctionExpression
public void visitFunctionExpression(FunctionExpressionTree tree)
- Overrides:
visitFunctionExpressionin classDoubleDispatchVisitor
-
visitMethodDeclaration
public void visitMethodDeclaration(MethodDeclarationTree tree)
- Overrides:
visitMethodDeclarationin classDoubleDispatchVisitor
-
visitAccessorMethodDeclaration
public void visitAccessorMethodDeclaration(AccessorMethodDeclarationTree tree)
- Overrides:
visitAccessorMethodDeclarationin classDoubleDispatchVisitor
-
-