diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-15 15:52:14 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-15 15:52:14 +0200 |
commit | 2da690d8e4c5d553d4bf9736ea6164fa4a909392 (patch) | |
tree | be20db13b71cdb913ce5c537360e402d90108b70 /plugins | |
parent | 03569280e742ad7d3aedeb4d5336b785ef2c7ea0 (diff) | |
download | sonarqube-2da690d8e4c5d553d4bf9736ea6164fa4a909392.tar.gz sonarqube-2da690d8e4c5d553d4bf9736ea6164fa4a909392.zip |
SONAR-5440 Remove the default "Hotspots" project dashboard
Diffstat (limited to 'plugins')
3 files changed, 4 insertions, 127 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java index 1c9bdcf3045..1476e9aefe7 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java @@ -28,7 +28,10 @@ import org.sonar.plugins.core.charts.DistributionAreaChart; import org.sonar.plugins.core.charts.DistributionBarChart; import org.sonar.plugins.core.charts.XradarChart; import org.sonar.plugins.core.colorizers.JavaColorizerFormat; -import org.sonar.plugins.core.dashboards.*; +import org.sonar.plugins.core.dashboards.GlobalDefaultDashboard; +import org.sonar.plugins.core.dashboards.ProjectDefaultDashboard; +import org.sonar.plugins.core.dashboards.ProjectIssuesDashboard; +import org.sonar.plugins.core.dashboards.ProjectTimeMachineDashboard; import org.sonar.plugins.core.issue.*; import org.sonar.plugins.core.issue.notification.*; import org.sonar.plugins.core.measurefilters.MyFavouritesFilter; @@ -230,7 +233,6 @@ public final class CorePlugin extends SonarPlugin { // dashboards ProjectDefaultDashboard.class, - ProjectHotspotDashboard.class, ProjectIssuesDashboard.class, ProjectTimeMachineDashboard.class, GlobalDefaultDashboard.class, diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectHotspotDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectHotspotDashboard.java deleted file mode 100644 index dd31fffc562..00000000000 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/ProjectHotspotDashboard.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.plugins.core.dashboards; - -import org.sonar.api.web.Dashboard; -import org.sonar.api.web.DashboardLayout; -import org.sonar.api.web.DashboardTemplate; - -/** - * Default "Hotspots" dashboard - * - * @since 2.13 - */ -public final class ProjectHotspotDashboard extends DashboardTemplate { - - private static final String HOTSPOT_METRIC = "hotspot_metric"; - private static final String METRIC_PROPERTY = "metric"; - - @Override - public String getName() { - return "Hotspots"; - } - - @Override - public Dashboard createDashboard() { - Dashboard dashboard = Dashboard.create(); - dashboard.setLayout(DashboardLayout.TWO_COLUMNS); - - addFirstColumn(dashboard); - addSecondColumn(dashboard); - - return dashboard; - } - - private void addFirstColumn(Dashboard dashboard) { - dashboard.addWidget("hotspot_most_violated_rules", 1); - - Dashboard.Widget widget = dashboard.addWidget(HOTSPOT_METRIC, 1); - widget.setProperty(METRIC_PROPERTY, "test_execution_time"); - - widget = dashboard.addWidget(HOTSPOT_METRIC, 1); - widget.setProperty(METRIC_PROPERTY, "complexity"); - - widget = dashboard.addWidget(HOTSPOT_METRIC, 1); - widget.setProperty(METRIC_PROPERTY, "duplicated_lines"); - } - - private void addSecondColumn(Dashboard dashboard) { - Dashboard.Widget widget = dashboard.addWidget(HOTSPOT_METRIC, 2); - widget.setProperty(METRIC_PROPERTY, "uncovered_lines"); - - widget = dashboard.addWidget(HOTSPOT_METRIC, 2); - widget.setProperty(METRIC_PROPERTY, "function_complexity"); - - widget = dashboard.addWidget(HOTSPOT_METRIC, 2); - widget.setProperty(METRIC_PROPERTY, "public_undocumented_api"); - } - -} diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectHotspotDashboardTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectHotspotDashboardTest.java deleted file mode 100644 index 9723b5202bd..00000000000 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectHotspotDashboardTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.plugins.core.dashboards; - -import org.junit.Test; -import org.sonar.api.web.Dashboard; -import org.sonar.api.web.DashboardLayout; -import org.sonar.plugins.core.CorePlugin; - -import static org.fest.assertions.Assertions.assertThat; - -public class ProjectHotspotDashboardTest { - ProjectHotspotDashboard template = new ProjectHotspotDashboard(); - - @Test - public void should_have_a_name() { - assertThat(template.getName()).isEqualTo("Hotspots"); - } - - @Test - public void should_be_registered_as_an_extension() { - assertThat(new CorePlugin().getExtensions()).contains(template.getClass()); - } - - @Test - public void should_create_dashboard() { - Dashboard dashboard = template.createDashboard(); - - assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS); - assertThat(dashboard.getWidgets()).hasSize(7); - } -} |