mirror of
https://github.com/SonarSource/sonarqube.git
synced 2024-09-13 15:45:52 +02:00
Add issues to report viewer
This commit is contained in:
parent
1dae2bb343
commit
5ad0f13351
@ -52,6 +52,7 @@ import org.sonar.core.util.CloseableIterator;
|
||||
import org.sonar.scanner.protocol.output.FileStructure.Domain;
|
||||
import org.sonar.scanner.protocol.output.ScannerReport;
|
||||
import org.sonar.scanner.protocol.output.ScannerReport.Component;
|
||||
import org.sonar.scanner.protocol.output.ScannerReport.Issue;
|
||||
import org.sonar.scanner.protocol.output.ScannerReport.Metadata;
|
||||
import org.sonar.scanner.protocol.output.ScannerReportReader;
|
||||
|
||||
@ -78,6 +79,8 @@ public class ScannerReportViewerApp {
|
||||
private TextLineNumber textLineNumber;
|
||||
private JScrollPane duplicationTab;
|
||||
private JEditorPane duplicationEditor;
|
||||
private JScrollPane issuesTab;
|
||||
private JEditorPane issuesEditor;
|
||||
|
||||
/**
|
||||
* Create the application.
|
||||
@ -191,6 +194,7 @@ public class ScannerReportViewerApp {
|
||||
updateSource(component);
|
||||
updateCoverage(component);
|
||||
updateDuplications(component);
|
||||
updateIssues(component);
|
||||
}
|
||||
|
||||
private void updateDuplications(Component component) {
|
||||
@ -207,6 +211,19 @@ public class ScannerReportViewerApp {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCoverage(Component component) {
|
||||
coverageEditor.setText("");
|
||||
try (CloseableIterator<ScannerReport.LineCoverage> it = reader.readComponentCoverage(component.getRef())) {
|
||||
@ -324,6 +341,12 @@ public class ScannerReportViewerApp {
|
||||
duplicationEditor = new JEditorPane();
|
||||
duplicationTab.setViewportView(duplicationEditor);
|
||||
|
||||
issuesTab = new JScrollPane();
|
||||
tabbedPane.addTab("Issues", null, issuesTab, null);
|
||||
|
||||
issuesEditor = new JEditorPane();
|
||||
issuesTab.setViewportView(issuesEditor);
|
||||
|
||||
treeScrollPane = new JScrollPane();
|
||||
treeScrollPane.setPreferredSize(new Dimension(200, 400));
|
||||
splitPane.setLeftComponent(treeScrollPane);
|
||||
|
Loading…
Reference in New Issue
Block a user