use of org.sonar.scanner.protocol.output.ScannerReport.Issue in project sonarqube by SonarSource.
the class MultilineIssuesMediumTest method testFlowWithSingleLocation.
@Test
public void testFlowWithSingleLocation() throws Exception {
List<Issue> issues = result.issuesFor(result.inputFile("xources/hello/Multiple.xoo"));
assertThat(issues).hasSize(1);
Issue issue = issues.get(0);
assertThat(issue.getMsg()).isEqualTo("Primary location");
assertThat(issue.getTextRange().getStartLine()).isEqualTo(6);
assertThat(issue.getTextRange().getStartOffset()).isEqualTo(23);
assertThat(issue.getTextRange().getEndLine()).isEqualTo(6);
assertThat(issue.getTextRange().getEndOffset()).isEqualTo(50);
assertThat(issue.getFlowList()).hasSize(1);
Flow flow = issue.getFlow(0);
assertThat(flow.getLocationList()).hasSize(1);
IssueLocation additionalLocation = flow.getLocation(0);
assertThat(additionalLocation.getMsg()).isEqualTo("Flow step #1");
assertThat(additionalLocation.getTextRange().getStartLine()).isEqualTo(7);
assertThat(additionalLocation.getTextRange().getStartOffset()).isEqualTo(26);
assertThat(additionalLocation.getTextRange().getEndLine()).isEqualTo(7);
assertThat(additionalLocation.getTextRange().getEndOffset()).isEqualTo(53);
}
use of org.sonar.scanner.protocol.output.ScannerReport.Issue in project sonarqube by SonarSource.
the class ScannerReportViewerApp method updateIssues.
private void updateIssues(Component component) {
issuesEditor.setText("");
try (CloseableIterator<Issue> it = reader.readComponentIssues(component.getRef())) {
while (it.hasNext()) {
Issue issue = it.next();
int offset = issuesEditor.getDocument().getEndPosition().getOffset();
issuesEditor.getDocument().insertString(offset, issue.toString(), null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read issues for " + getNodeName(component), e);
}
}
Aggregations