예제 #1
0
    def visit_any_function(self, node: AnyFunctionDef) -> None:
        """
        Counts cognitive complexity.

        Raises:
            CognitiveComplexityViolation
            CognitiveModuleComplexityViolation

        """
        self._functions[node] = cognitive.cognitive_score(node)
        self.generic_visit(node)
예제 #2
0
 def visit_any_function(self, node: AnyFunctionDef) -> None:
     """Counts cognitive complexity."""
     self._functions[node] = cognitive.cognitive_score(node)
     self.generic_visit(node)
예제 #3
0
 def factory(src: str) -> int:
     funcdef = _find_function(parse_ast_tree(src))
     assert funcdef, 'No function definition found'
     return cognitive.cognitive_score(funcdef)