diff options
author | Michal Duda <michal.duda@sonarsource.com> | 2020-09-11 14:30:31 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-09-29 20:07:41 +0000 |
commit | 8a94f2ffc23369e675fceb34c03c98e1535d49d6 (patch) | |
tree | c5eb21cccc85b7d73af13e201387e52d51659156 /sonar-scanner-protocol | |
parent | 4b3d914bf578d1eb88fc9ca79efef00843511865 (diff) | |
download | sonarqube-8a94f2ffc23369e675fceb34c03c98e1535d49d6.tar.gz sonarqube-8a94f2ffc23369e675fceb34c03c98e1535d49d6.zip |
SONAR-13867 Collect number of indexed C/C++ files in the scanner
Diffstat (limited to 'sonar-scanner-protocol')
-rw-r--r-- | sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java | 33 | ||||
-rw-r--r-- | sonar-scanner-protocol/src/main/protobuf/scanner_report.proto | 2 |
2 files changed, 32 insertions, 3 deletions
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java index 7349fa688f8..20b8f682017 100644 --- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java +++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java @@ -32,9 +32,12 @@ import java.util.Map; import java.util.Scanner; import javax.annotation.CheckForNull; import javax.swing.*; -import javax.swing.UIManager.*; -import javax.swing.event.*; -import javax.swing.tree.*; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +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; @@ -94,6 +97,8 @@ public class ScannerReportViewerApp { private JEditorPane cpdTextBlocksEditor; private JScrollPane significantCodeTab; private JEditorPane significantCodeEditor; + private JScrollPane metadataTab; + private JEditorPane metadataEditor; /** * Create the application. @@ -187,6 +192,7 @@ public class ScannerReportViewerApp { updateAdHocRules(); updateQualityProfiles(); updatePlugins(); + updateMetadata(); } private void loadComponents() { @@ -348,6 +354,21 @@ public class ScannerReportViewerApp { } } + private void updateMetadata() { + metadataEditor.setText(""); + + StringBuilder builder = new StringBuilder(); + Metadata data = reader.readMetadata(); + builder.append("Project key: ").append(data.getProjectKey()).append("\n"); + builder.append("Project version: ").append(data.getProjectVersion()).append("\n"); + builder.append("Scm revision ID: ").append(data.getScmRevisionId()).append("\n"); + if (data.getNotAnalyzedFilesByLanguageCount() > 0) { + builder.append("Not analyzed files in project:").append("\n"); + data.getNotAnalyzedFilesByLanguageMap().forEach((key, value) -> builder.append(" ").append(key).append(": ").append(value).append("\n")); + } + metadataEditor.setText(builder.toString()); + } + private void updateActiveRules() { activeRuleEditor.setText(""); @@ -588,6 +609,12 @@ public class ScannerReportViewerApp { significantCodeEditor = new JEditorPane(); significantCodeTab.setViewportView(significantCodeEditor); + metadataTab = new JScrollPane(); + tabbedPane.addTab("Metadata", null, metadataTab, null); + + metadataEditor = new JEditorPane(); + metadataTab.setViewportView(metadataEditor); + treeScrollPane = new JScrollPane(); treeScrollPane.setPreferredSize(new Dimension(200, 400)); splitPane.setLeftComponent(treeScrollPane); diff --git a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto index b984bf7abbb..3e3a1f80351 100644 --- a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto +++ b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto @@ -58,6 +58,8 @@ message Metadata { int64 forkDate = 19; + map<string, int32> not_analyzed_files_by_language = 20; + message QProfile { string key = 1; string name = 2; |