private void addComplexityWithoutNesting(SyntaxToken secondaryLocationToken, int addedComplexity) { value += addedComplexity; complexityComponents.add(new ComplexityComponent(secondaryLocationToken, addedComplexity)); }
private void addComplexityWithoutNesting(SyntaxToken secondaryLocationToken, int addedComplexity) { value += addedComplexity; complexityComponents.add(new ComplexityComponent(secondaryLocationToken, addedComplexity)); }
static TestComplexityComponent create(ComplexityComponent complexityComponent) { return new TestComplexityComponent(complexityComponent.tree().toString(), complexityComponent.addedComplexity()); }
private void checkFunctionComplexity(FunctionTree functionTree) { CognitiveComplexity complexity = CognitiveComplexityVisitor.complexity(functionTree); if (complexity.getValue() > threshold) { String message = String.format(MESSAGE, complexity.getValue(), threshold); int cost = complexity.getValue() - threshold; PreciseIssue issue = context().newIssue(this, (functionTree).functionToken(), message).cost(cost); complexity.getComplexityComponents().forEach(complexityComponent -> issue.secondary( complexityComponent.tree(), secondaryMessage(complexityComponent.addedComplexity()))); } }
private void checkFunctionComplexity(FunctionTree functionTree) { CognitiveComplexity complexity = CognitiveComplexityVisitor.complexity(functionTree); if (complexity.getValue() > threshold) { String message = String.format(MESSAGE, complexity.getValue(), threshold); int cost = complexity.getValue() - threshold; PreciseIssue issue = context().newIssue(this, (functionTree).functionToken(), message).cost(cost); complexity.getComplexityComponents().forEach(complexityComponent -> issue.secondary( complexityComponent.tree(), secondaryMessage(complexityComponent.addedComplexity()))); } }