newIssue.addLocation(flowLocations.get(0)); } else { newIssue.addFlow(flowLocations);
public PlSqlIssue addSecondaryLocation(InputFile file, int startLine, int startLineOffset, int endLine, int endLineOffset, String message) { newIssue.addLocation(newIssue.newLocation().on(file) .at(file.newRange(startLine, startLineOffset, endLine, endLineOffset)).message(message)); return this; }
newIssue.addLocation(flowLocations.get(0)); } else { newIssue.addFlow(flowLocations);
public JavaIssue addSecondaryLocation(InputFile file, int startLine, int startLineOffset, int endLine, int endLineOffset, String message) { newIssue.addLocation( newIssue.newLocation() .on(file) .at(file.newRange(startLine, startLineOffset, endLine, endLineOffset)) .message(message)); return this; }
public JavaIssue addSecondaryLocation(InputFile file, int startLine, int startLineOffset, int endLine, int endLineOffset, String message) { newIssue.addLocation( newIssue.newLocation() .on(file) .at(file.newRange(startLine, startLineOffset, endLine, endLineOffset)) .message(message)); return this; }
public JavaIssue addSecondaryLocation(InputFile file, int startLine, int startLineOffset, int endLine, int endLineOffset, String message) { newIssue.addLocation( newIssue.newLocation() .on(file) .at(file.newRange(startLine, startLineOffset, endLine, endLineOffset)) .message(message)); return this; }
private void saveIssues(InputFile inputFile, PlSqlVisitor check, List<PreciseIssue> issues) { RuleKey ruleKey = plsqlChecks.ruleKey(check); for (PreciseIssue preciseIssue : issues) { NewIssue newIssue = context.newIssue().forRule(ruleKey); Integer cost = preciseIssue.cost(); if (cost != null) { newIssue.gap(cost.doubleValue()); } newIssue.at(newLocation(inputFile, newIssue, preciseIssue.primaryLocation())); for (IssueLocation secondaryLocation : preciseIssue.secondaryLocations()) { newIssue.addLocation(newLocation(inputFile, newIssue, secondaryLocation)); } newIssue.save(); } }
private void saveIssues(InputFile inputFile, PythonCheck check, List<PreciseIssue> issues) { RuleKey ruleKey = checks.ruleKey(check); for (PreciseIssue preciseIssue : issues) { NewIssue newIssue = context .newIssue() .forRule(ruleKey); Integer cost = preciseIssue.cost(); if (cost != null) { newIssue.gap(cost.doubleValue()); } newIssue.at(newLocation(inputFile, newIssue, preciseIssue.primaryLocation())); for (IssueLocation secondaryLocation : preciseIssue.secondaryLocations()) { newIssue.addLocation(newLocation(inputFile, newIssue, secondaryLocation)); } newIssue.save(); } }
private void saveIssues(InputFile inputFile, PythonCheck check, List<PreciseIssue> issues) { RuleKey ruleKey = checks.ruleKey(check); for (PreciseIssue preciseIssue : issues) { NewIssue newIssue = context .newIssue() .forRule(ruleKey); Integer cost = preciseIssue.cost(); if (cost != null) { newIssue.gap(cost.doubleValue()); } newIssue.at(newLocation(inputFile, newIssue, preciseIssue.primaryLocation())); for (IssueLocation secondaryLocation : preciseIssue.secondaryLocations()) { newIssue.addLocation(newLocation(inputFile, newIssue, secondaryLocation)); } newIssue.save(); } }
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 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(); }
public static void save(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.effortToFix(issue.cost()); } for (IssueLocation secondary : issue.secondaryLocations()) { newIssue.addLocation(newLocation(inputFile, newIssue, secondary)); } newIssue.save(); }
private void reportIssue(Issue issue, SensorContext context, InputFile inputFile) { // TODO improve common rule engine to handle this out of the box RuleKey ruleKey = checks.ruleKey(issue.getCheck()); Objects.requireNonNull(ruleKey, "Rule key not found for " + issue.getCheck().getClass()); NewIssue newIssue = context.newIssue(); NewIssueLocation location = newIssue.newLocation() .on(inputFile) .message(issue.getMessage()); if (issue.hasNodeLocation()) { location.at(newRange(inputFile, issue.getPrimary().from, issue.getPrimary().to)); } else if (issue.hasLineLocation()) { location.at(inputFile.selectLine(issue.getPrimary().line)); } newIssue.forRule(ruleKey).at(location).gap(issue.getEffortToFix()); Arrays.stream(issue.getSecondaries()).forEach(secondary -> newIssue.addLocation( newIssue.newLocation() .on(inputFile) .at(newRange(inputFile, secondary.from, secondary.to)) .message(secondary.description == null ? "" : secondary.description))); newIssue.save(); }
static void saveIssue(SensorContext sensorContext, TypeScriptRules typeScriptRules, Issue issue, InputFile inputFile) { RuleKey ruleKey = typeScriptRules.ruleKeyFromTsLintKey(issue.ruleName); NewIssue newIssue = sensorContext.newIssue().forRule(ruleKey); NewIssueLocation location = newIssue.newLocation(); location.on(inputFile); location.message(issue.failure); // semicolon rule if (ruleKey.rule().equals("S1438")) { location.at(inputFile.selectLine(issue.startPosition.line + 1)); } else if (!TypeScriptRules.FILE_LEVEL_RULES.contains(ruleKey.rule())) { location.at(inputFile.newRange( issue.startPosition.line + 1, issue.startPosition.character, issue.endPosition.line + 1, issue.endPosition.character)); } newIssue.at(location); // there is not secondaryLocations for issues coming from tslint rules if (issue.secondaryLocations != null) { for (SecondaryLocation secondaryLocation : issue.secondaryLocations) { NewIssueLocation newSecondaryLocation = newIssue.newLocation().on(inputFile); setSecondaryLocation(newSecondaryLocation, secondaryLocation, inputFile); newIssue.addLocation(newSecondaryLocation); } } if (issue.cost != null) { newIssue.gap(issue.cost); } newIssue.save(); }
private void savePreciseIssue(PreciseIssue issue) { NewIssue newIssue = sensorContext.newIssue(); InputFile primaryFile = Preconditions.checkNotNull(fileSystem.inputFile(fileSystem.predicates().is(issue.primaryLocation().file()))); newIssue .forRule(ruleKey(issue.check())) .at(newLocation(primaryFile, newIssue, issue.primaryLocation())); if (issue.cost() != null) { newIssue.gap(issue.cost()); } InputFile secondaryFile; for (IssueLocation secondary : issue.secondaryLocations()) { secondaryFile = fileSystem.inputFile(fileSystem.predicates().is(secondary.file())); if (secondaryFile == null) { secondaryFile = primaryFile; } newIssue.addLocation(newLocation(secondaryFile, newIssue, secondary)); } newIssue.save(); }
private void saveFileIssue(FileIssue issue) { NewIssue newIssue = sensorContext.newIssue(); InputFile primaryFile = Preconditions.checkNotNull(fileSystem.inputFile(fileSystem.predicates().is(issue.file()))); NewIssueLocation primaryLocation = newIssue.newLocation() .message(issue.message()) .on(primaryFile); newIssue .forRule(ruleKey(issue.check())) .at(primaryLocation); if (issue.cost() != null) { newIssue.gap(issue.cost()); } InputFile secondaryFile; for (IssueLocation secondary : issue.secondaryLocations()) { secondaryFile = fileSystem.inputFile(fileSystem.predicates().is(secondary.file())); if (secondaryFile == null) { secondaryFile = primaryFile; } newIssue.addLocation(newLocation(secondaryFile, newIssue, secondary)); } newIssue.save(); }
preciseIssue.secondaryLocations().forEach(secondary -> newIssue.addLocation(newLocation(inputFile, newIssue, secondary)));
preciseIssue.secondaryLocations().forEach(secondary -> newIssue.addLocation(newLocation(inputFile, newIssue, secondary)));