예제 #1
0
    def _check_function_internals(self) -> None:
        for node, variables in self._counter.variables.items():
            if len(variables) > self.options.max_local_variables:
                self.add_violation(
                    TooManyLocalsViolation(node, text=node.name), )

        for node, expressions in self._counter.expressions.items():
            if expressions > self.options.max_expressions:
                self.add_violation(
                    TooManyExpressionsViolation(node, text=node.name), )
예제 #2
0
    def _check_function_internals(self) -> None:
        for var_node, variables in self._counter.variables.items():
            if len(variables) > self.options.max_local_variables:
                self.add_violation(
                    TooManyLocalsViolation(
                        var_node,
                        text=str(len(variables)),
                        baseline=self.options.max_local_variables,
                    ), )

        for exp_node, expressions in self._counter.expressions.items():
            if expressions > self.options.max_expressions:
                self.add_violation(
                    TooManyExpressionsViolation(
                        exp_node,
                        text=str(expressions),
                        baseline=self.options.max_expressions,
                    ), )