private static void savePreciseIssue( SensorContext sensorContext, InputFile inputFile, RuleKey ruleKey, PreciseIssue issue) { NewIssue newIssue = sensorContext.newIssue(); newIssue.forRule(ruleKey).at(newLocation(inputFile, newIssue, issue.primaryLocation())); if (issue.cost() != null) { newIssue.gap(issue.cost()); } for (IssueLocation secondary : issue.secondaryLocations()) { newIssue.addLocation(newLocation(inputFile, newIssue, secondary)); } newIssue.save(); }
private void raiseIssue(FunctionTree tree, List<Tree> complexityTrees) { int complexity = complexityTrees.size(); String message = String.format(MESSAGE, complexity, maximumFunctionComplexityThreshold); IssueLocation primaryIssueLocation = new IssueLocation(((JavaScriptTree) tree).getFirstToken(), tree.parameterClause(), message); PreciseIssue issue = addIssue(new PreciseIssue(this, primaryIssueLocation)); for (Tree complexityTree : complexityTrees) { issue.secondary(complexityTree, "+1"); } issue.cost((double) complexity - maximumFunctionComplexityThreshold); }