Module implementing a checker for code complexity.
None |
ComplexityChecker | Class implementing a checker for code complexity. |
LineComplexityVisitor | Class calculating the number of AST nodes per line of code and the median nodes/line score. |
None |
Class implementing a checker for code complexity.
Codes |
None |
ComplexityChecker | Constructor |
__checkLineComplexity | Private method to check the complexity of a single line of code and the median line complexity of the source code. |
__checkMcCabeComplexity | Private method to check the McCabe code complexity. |
__error | Private method to record an issue. |
__ignoreCode | Private method to check if the message code should be ignored. |
__reportInvalidSyntax | Private method to report a syntax error. |
run | Public method to check the given source for code complexity. |
None |
Constructor
Private method to check the complexity of a single line of code and the median line complexity of the source code.
Complexity is defined as the number of AST nodes produced by a line of code.
Private method to check the McCabe code complexity.
Private method to record an issue.
Private method to check if the message code should be ignored.
Private method to report a syntax error.
Public method to check the given source for code complexity.
Class calculating the number of AST nodes per line of code and the median nodes/line score.
None |
None |
LineComplexityVisitor | Constructor |
score | Public method to calculate the median. |
sortedList | Public method to get a sorted list of (line, nodes) tuples. |
visit | Public method to recursively visit all the nodes and add up the instructions. |
None |
Constructor
Public method to calculate the median.
Public method to get a sorted list of (line, nodes) tuples.
Public method to recursively visit all the nodes and add up the instructions.