import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.List;
+import java.util.Map;
import java.util.Scanner;
-
import javax.annotation.CheckForNull;
import javax.swing.JEditorPane;
import javax.swing.JFileChooser;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;
-
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.sonar.core.util.CloseableIterator;
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.ScannerReport.Metadata.Plugin;
+import org.sonar.scanner.protocol.output.ScannerReport.Metadata.QProfile;
import org.sonar.scanner.protocol.output.ScannerReportReader;
public class ScannerReportViewerApp {
private JEditorPane scmEditor;
private JScrollPane activeRuleTab;
private JEditorPane activeRuleEditor;
+ private JScrollPane qualityProfileTab;
+ private JEditorPane qualityProfileEditor;
+ private JScrollPane pluginTab;
+ private JEditorPane pluginEditor;
private JScrollPane cpdTextBlocksTab;
private JEditorPane cpdTextBlocksEditor;
updateTitle();
loadComponents();
updateActiveRules();
+ updateQualityProfiles();
+ updatePlugins();
}
private void loadComponents() {
}
}
}
-
+
private void updateDuplications(Component component) {
duplicationEditor.setText("");
if (reader.hasCoverage(component.getRef())) {
}
}
+ private void updateQualityProfiles() {
+ qualityProfileEditor.setText("");
+
+ StringBuilder builder = new StringBuilder();
+ for (Map.Entry<String, QProfile> qp : metadata.getQprofilesPerLanguage().entrySet()) {
+ builder.append(qp.getKey()).append(":\n").append(qp.getValue()).append("\n\n");
+
+ }
+ qualityProfileEditor.setText(builder.toString());
+ }
+
+ private void updatePlugins() {
+ pluginEditor.setText("");
+
+ StringBuilder builder = new StringBuilder();
+ for (Map.Entry<String, Plugin> p : metadata.getPluginsByKey().entrySet()) {
+ builder.append(p.getKey()).append(":\n").append(p.getValue()).append("\n\n");
+
+ }
+ pluginEditor.setText(builder.toString());
+ }
+
private void updateHighlighting(Component component) {
highlightingEditor.setText("");
try (CloseableIterator<ScannerReport.SyntaxHighlightingRule> it = reader.readComponentSyntaxHighlighting(component.getRef())) {
scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), changeset + "\n", null);
index++;
}
-
+
scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), "\n", null);
int line = 1;
for (Integer idx : changesetIndexByLine) {
activeRuleEditor = new JEditorPane();
activeRuleTab.setViewportView(activeRuleEditor);
+ qualityProfileTab = new JScrollPane();
+ tabbedPane.addTab("Quality Profiles", null, qualityProfileTab, null);
+
+ qualityProfileEditor = new JEditorPane();
+ qualityProfileTab.setViewportView(qualityProfileEditor);
+
+ pluginTab = new JScrollPane();
+ tabbedPane.addTab("Plugins", null, pluginTab, null);
+
+ pluginEditor = new JEditorPane();
+ pluginTab.setViewportView(pluginEditor);
+
cpdTextBlocksTab = new JScrollPane();
tabbedPane.addTab("CPD Text Blocks", null, cpdTextBlocksTab, null);
-
+
cpdTextBlocksEditor = new JEditorPane();
cpdTextBlocksTab.setViewportView(cpdTextBlocksEditor);
-
+
treeScrollPane = new JScrollPane();
treeScrollPane.setPreferredSize(new Dimension(200, 400));
splitPane.setLeftComponent(treeScrollPane);