Package org.sonar.python.metrics
Class CognitiveComplexityVisitor
- java.lang.Object
-
- org.sonar.python.tree.BaseTreeVisitor
-
- org.sonar.python.metrics.CognitiveComplexityVisitor
-
- All Implemented Interfaces:
PyTreeVisitor
public class CognitiveComplexityVisitor extends BaseTreeVisitor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCognitiveComplexityVisitor.SecondaryLocationConsumer
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intcomplexity(Tree tree, CognitiveComplexityVisitor.SecondaryLocationConsumer secondaryLocationConsumer)intgetComplexity()voidvisitBinaryExpression(PyBinaryExpressionTree pyBinaryExpressionTree)voidvisitClassDef(PyClassDefTree pyClassDefTree)voidvisitConditionalExpression(PyConditionalExpressionTree pyConditionalExpressionTree)voidvisitElseStatement(PyElseStatementTree pyElseStatementTree)voidvisitExceptClause(PyExceptClauseTree pyExceptClauseTree)voidvisitForStatement(PyForStatementTree pyForStatementTree)voidvisitFunctionDef(PyFunctionDefTree pyFunctionDefTree)voidvisitIfStatement(PyIfStatementTree pyIfStatementTree)voidvisitStatementList(PyStatementListTree pyStatementListTree)voidvisitWhileStatement(PyWhileStatementTree pyWhileStatementTree)-
Methods inherited from class org.sonar.python.tree.BaseTreeVisitor
scan, scan, visitAliasedName, visitAnnotatedAssignment, visitArgument, visitArgumentList, visitAssertStatement, visitAssignmentStatement, visitAwaitExpression, visitBreakStatement, visitCallExpression, visitCompoundAssignment, visitComprehensionFor, visitComprehensionIf, visitContinueStatement, visitDecorator, visitDelStatement, visitDictCompExpression, visitDictionaryLiteral, visitDottedName, visitEllipsis, visitExecStatement, visitExpressionList, visitExpressionStatement, visitFileInput, visitFinallyClause, visitGlobalStatement, visitImportFrom, visitImportName, visitKeyValuePair, visitLambda, visitListLiteral, visitName, visitNone, visitNonlocalStatement, visitNumericLiteral, visitParameter, visitParameterList, visitParenthesizedExpression, visitPassStatement, visitPrintStatement, visitPyListOrSetCompExpression, visitQualifiedExpression, visitRaiseStatement, visitRepr, visitReturnStatement, visitSetLiteral, visitSliceExpression, visitSliceItem, visitSliceList, visitStarredExpression, visitStringElement, visitStringLiteral, visitSubscriptionExpression, visitTryStatement, visitTuple, visitTupleParameter, visitTypeAnnotation, visitUnaryExpression, visitWithItem, visitWithStatement, visitYieldExpression, visitYieldStatement
-
-
-
-
Method Detail
-
complexity
public static int complexity(Tree tree, @Nullable CognitiveComplexityVisitor.SecondaryLocationConsumer secondaryLocationConsumer)
-
getComplexity
public int getComplexity()
-
visitIfStatement
public void visitIfStatement(PyIfStatementTree pyIfStatementTree)
- Specified by:
visitIfStatementin interfacePyTreeVisitor- Overrides:
visitIfStatementin classBaseTreeVisitor
-
visitElseStatement
public void visitElseStatement(PyElseStatementTree pyElseStatementTree)
- Specified by:
visitElseStatementin interfacePyTreeVisitor- Overrides:
visitElseStatementin classBaseTreeVisitor
-
visitWhileStatement
public void visitWhileStatement(PyWhileStatementTree pyWhileStatementTree)
- Specified by:
visitWhileStatementin interfacePyTreeVisitor- Overrides:
visitWhileStatementin classBaseTreeVisitor
-
visitForStatement
public void visitForStatement(PyForStatementTree pyForStatementTree)
- Specified by:
visitForStatementin interfacePyTreeVisitor- Overrides:
visitForStatementin classBaseTreeVisitor
-
visitExceptClause
public void visitExceptClause(PyExceptClauseTree pyExceptClauseTree)
- Specified by:
visitExceptClausein interfacePyTreeVisitor- Overrides:
visitExceptClausein classBaseTreeVisitor
-
visitBinaryExpression
public void visitBinaryExpression(PyBinaryExpressionTree pyBinaryExpressionTree)
- Specified by:
visitBinaryExpressionin interfacePyTreeVisitor- Overrides:
visitBinaryExpressionin classBaseTreeVisitor
-
visitFunctionDef
public void visitFunctionDef(PyFunctionDefTree pyFunctionDefTree)
- Specified by:
visitFunctionDefin interfacePyTreeVisitor- Overrides:
visitFunctionDefin classBaseTreeVisitor
-
visitClassDef
public void visitClassDef(PyClassDefTree pyClassDefTree)
- Specified by:
visitClassDefin interfacePyTreeVisitor- Overrides:
visitClassDefin classBaseTreeVisitor
-
visitStatementList
public void visitStatementList(PyStatementListTree pyStatementListTree)
- Specified by:
visitStatementListin interfacePyTreeVisitor- Overrides:
visitStatementListin classBaseTreeVisitor
-
visitConditionalExpression
public void visitConditionalExpression(PyConditionalExpressionTree pyConditionalExpressionTree)
- Specified by:
visitConditionalExpressionin interfacePyTreeVisitor- Overrides:
visitConditionalExpressionin classBaseTreeVisitor
-
-