Java Code Examples for org.sonar.api.batch.sensor.issue.NewIssue#gap()
The following examples show how to use
org.sonar.api.batch.sensor.issue.NewIssue#gap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IssueSaver.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 6 votes |
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(); }
Example 2
Source File: IssueSaver.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 6 votes |
private void saveLineIssue(LineIssue 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) .at(primaryFile.selectLine(issue.line())); newIssue .forRule(ruleKey(issue.check())) .at(primaryLocation); if (issue.cost() != null) { newIssue.gap(issue.cost()); } newIssue.save(); }
Example 3
Source File: IssueSaver.java From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 | 6 votes |
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(); }
Example 4
Source File: IssueSaver.java From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 | 6 votes |
private void saveLineIssue(LineIssue 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) .at(primaryFile.selectLine(issue.line())); newIssue .forRule(ruleKey(issue.check())) .at(primaryLocation); if (issue.cost() != null) { newIssue.gap(issue.cost()); } newIssue.save(); }
Example 5
Source File: EsqlSensor.java From sonar-esql-plugin with Apache License 2.0 | 6 votes |
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(); }
Example 6
Source File: IssueSaver.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
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(); }
Example 7
Source File: IssueSaver.java From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 | 5 votes |
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(); }
Example 8
Source File: EsqlSensor.java From sonar-esql-plugin with Apache License 2.0 | 5 votes |
private static void saveIssue(NewIssue newIssue, NewIssueLocation primaryLocation, RuleKey ruleKey, Issue issue) { newIssue .forRule(ruleKey) .at(primaryLocation); if (issue.cost() != null) { newIssue.gap(issue.cost()); } newIssue.save(); }