aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/apps/issues/workspace-list-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js6
-rw-r--r--sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java49
3 files changed, 39 insertions, 22 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js
index 45efbf8dc0d..027b1eaebe3 100644
--- a/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js
@@ -85,9 +85,9 @@ export default WorkspaceListView.extend({
var $container = this.getChildViewContainer(compositeView),
model = this.collection.at(index);
if (model != null) {
- var prev = this.collection.at(index - 1),
- putComponent = prev == null;
- if (prev != null) {
+ var prev = index > 0 && this.collection.at(index - 1),
+ putComponent = !prev;
+ if (prev) {
var fullComponent = [model.get('project'), model.get('component')].join(' '),
fullPrevComponent = [prev.get('project'), prev.get('component')].join(' ');
if (fullComponent !== fullPrevComponent) {
diff --git a/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js
index d87d3dc5e70..392f7056abf 100644
--- a/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js
+++ b/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js
@@ -204,9 +204,9 @@ export const DebtMain = React.createClass({
<div className="overview-card">
<DomainBubbleChart {...this.props}
- xMetric="violations"
- yMetric="sqale_index"
- sizeMetrics={['blocker_violations', 'critical_violations']}/>
+ xMetric="ncloc"
+ yMetric="violations"
+ sizeMetrics={['sqale_index']}/>
</div>
</div>
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java
index a2f9352f6d2..d0089c37dc3 100644
--- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java
+++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/viewer/ViewerApplication.java
@@ -31,7 +31,6 @@ import java.nio.charset.StandardCharsets;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Scanner;
-
import javax.swing.JEditorPane;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
@@ -48,7 +47,6 @@ import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;
-
import org.sonar.batch.protocol.output.BatchReport;
import org.sonar.batch.protocol.output.BatchReport.Component;
import org.sonar.batch.protocol.output.BatchReport.Metadata;
@@ -75,6 +73,8 @@ public class ViewerApplication {
private JScrollPane coverageTab;
private JEditorPane coverageEditor;
private TextLineNumber textLineNumber;
+ private JScrollPane duplicationTab;
+ private JEditorPane duplicationEditor;
/**
* Create the application.
@@ -185,22 +185,35 @@ public class ViewerApplication {
updateHighlighting(component);
updateSource(component);
updateCoverage(component);
+ updateDuplications(component);
}
- private void updateCoverage(Component component) {
- coverageEditor.setText("");
+ private void updateDuplications(Component component) {
+ duplicationEditor.setText("");
if (reader.hasCoverage(component.getRef())) {
- try (CloseableIterator<BatchReport.Coverage> it = reader.readComponentCoverage(component.getRef())) {
+ try (CloseableIterator<BatchReport.Duplication> it = reader.readComponentDuplications(component.getRef())) {
while (it.hasNext()) {
- BatchReport.Coverage coverage = it.next();
- coverageEditor.getDocument().insertString(coverageEditor.getDocument().getEndPosition().getOffset(), coverage.toString() + "\n", null);
+ BatchReport.Duplication dup = it.next();
+ duplicationEditor.getDocument().insertString(duplicationEditor.getDocument().getEndPosition().getOffset(), dup.toString() + "\n", null);
}
} catch (Exception e) {
- throw new IllegalStateException("Can't read code coverage for " + getNodeName(component), e);
+ throw new IllegalStateException("Can't read duplications for " + getNodeName(component), e);
}
}
}
+ private void updateCoverage(Component component) {
+ coverageEditor.setText("");
+ try (CloseableIterator<BatchReport.Coverage> it = reader.readComponentCoverage(component.getRef())) {
+ while (it.hasNext()) {
+ BatchReport.Coverage coverage = it.next();
+ coverageEditor.getDocument().insertString(coverageEditor.getDocument().getEndPosition().getOffset(), coverage.toString() + "\n", null);
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException("Can't read code coverage for " + getNodeName(component), e);
+ }
+ }
+
private void updateSource(Component component) {
File sourceFile = reader.getFileStructure().fileFor(Domain.SOURCE, component.getRef());
sourceEditor.setText("");
@@ -220,15 +233,13 @@ public class ViewerApplication {
private void updateHighlighting(Component component) {
highlightingEditor.setText("");
- if (reader.hasSyntaxHighlighting(component.getRef())) {
- try (CloseableIterator<BatchReport.SyntaxHighlighting> it = reader.readComponentSyntaxHighlighting(component.getRef())) {
- while (it.hasNext()) {
- BatchReport.SyntaxHighlighting rule = it.next();
- highlightingEditor.getDocument().insertString(highlightingEditor.getDocument().getEndPosition().getOffset(), rule.toString() + "\n", null);
- }
- } catch (Exception e) {
- throw new IllegalStateException("Can't read syntax highlighting for " + getNodeName(component), e);
+ try (CloseableIterator<BatchReport.SyntaxHighlighting> it = reader.readComponentSyntaxHighlighting(component.getRef())) {
+ while (it.hasNext()) {
+ BatchReport.SyntaxHighlighting rule = it.next();
+ highlightingEditor.getDocument().insertString(highlightingEditor.getDocument().getEndPosition().getOffset(), rule.toString() + "\n", null);
}
+ } catch (Exception e) {
+ throw new IllegalStateException("Can't read syntax highlighting for " + getNodeName(component), e);
}
}
@@ -284,6 +295,12 @@ public class ViewerApplication {
coverageEditor = new JEditorPane();
coverageTab.setViewportView(coverageEditor);
+ duplicationTab = new JScrollPane();
+ tabbedPane.addTab("Duplications", null, duplicationTab, null);
+
+ duplicationEditor = new JEditorPane();
+ duplicationTab.setViewportView(duplicationEditor);
+
treeScrollPane = new JScrollPane();
treeScrollPane.setPreferredSize(new Dimension(200, 400));
splitPane.setLeftComponent(treeScrollPane);