aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-10-11 15:39:16 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-10-11 15:39:16 +0200
commit2cfb8ded13140ba04818580307644b22491337f6 (patch)
tree80015e0e9eb523ff801207e5e017ed5cbc349027 /plugins/sonar-core-plugin
parenta74e5ec2fa7cd0b6d6959e534440644c7b913e0c (diff)
downloadsonarqube-2cfb8ded13140ba04818580307644b22491337f6.tar.gz
sonarqube-2cfb8ded13140ba04818580307644b22491337f6.zip
SONAR-4717 Display "Technical Debt" in the Issues widget
Diffstat (limited to 'plugins/sonar-core-plugin')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java93
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtWidget.java32
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssuesWidget.java (renamed from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/RulesWidget.java)11
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties11
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb (renamed from plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb)22
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt.html.erb18
6 files changed, 38 insertions, 149 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 dd967953e53..52305eb9676 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
@@ -20,11 +20,7 @@
package org.sonar.plugins.core;
import com.google.common.collect.ImmutableList;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.Properties;
-import org.sonar.api.Property;
-import org.sonar.api.PropertyType;
-import org.sonar.api.SonarPlugin;
+import org.sonar.api.*;
import org.sonar.api.checks.NoSonarFilter;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.resources.Java;
@@ -36,91 +32,21 @@ 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.GlobalDefaultDashboard;
-import org.sonar.plugins.core.dashboards.ProjectDefaultDashboard;
-import org.sonar.plugins.core.dashboards.ProjectHotspotDashboard;
-import org.sonar.plugins.core.dashboards.ProjectIssuesDashboard;
-import org.sonar.plugins.core.dashboards.ProjectTimeMachineDashboard;
-import org.sonar.plugins.core.issue.CountFalsePositivesDecorator;
-import org.sonar.plugins.core.issue.CountUnresolvedIssuesDecorator;
-import org.sonar.plugins.core.issue.InitialOpenIssuesSensor;
-import org.sonar.plugins.core.issue.InitialOpenIssuesStack;
-import org.sonar.plugins.core.issue.IssueHandlers;
-import org.sonar.plugins.core.issue.IssueTracking;
-import org.sonar.plugins.core.issue.IssueTrackingDecorator;
-import org.sonar.plugins.core.issue.IssuesDensityDecorator;
-import org.sonar.plugins.core.issue.WeightedIssuesDecorator;
+import org.sonar.plugins.core.dashboards.*;
+import org.sonar.plugins.core.issue.*;
import org.sonar.plugins.core.issue.ignore.IgnoreIssuesPlugin;
-import org.sonar.plugins.core.issue.notification.ChangesOnMyIssueNotificationDispatcher;
-import org.sonar.plugins.core.issue.notification.IssueChangesEmailTemplate;
-import org.sonar.plugins.core.issue.notification.NewFalsePositiveNotificationDispatcher;
-import org.sonar.plugins.core.issue.notification.NewIssuesEmailTemplate;
-import org.sonar.plugins.core.issue.notification.NewIssuesNotificationDispatcher;
-import org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob;
+import org.sonar.plugins.core.issue.notification.*;
import org.sonar.plugins.core.measurefilters.MyFavouritesFilter;
import org.sonar.plugins.core.measurefilters.ProjectFilter;
import org.sonar.plugins.core.notifications.alerts.NewAlerts;
import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
-import org.sonar.plugins.core.sensors.BranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.CheckAlertThresholds;
-import org.sonar.plugins.core.sensors.CommentDensityDecorator;
-import org.sonar.plugins.core.sensors.CoverageDecorator;
-import org.sonar.plugins.core.sensors.CoverageMeasurementFilter;
-import org.sonar.plugins.core.sensors.DirectoriesDecorator;
-import org.sonar.plugins.core.sensors.FileHashSensor;
-import org.sonar.plugins.core.sensors.FilesDecorator;
-import org.sonar.plugins.core.sensors.GenerateAlertEvents;
-import org.sonar.plugins.core.sensors.ItBranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.ItCoverageDecorator;
-import org.sonar.plugins.core.sensors.ItLineCoverageDecorator;
-import org.sonar.plugins.core.sensors.LineCoverageDecorator;
-import org.sonar.plugins.core.sensors.ManualMeasureDecorator;
-import org.sonar.plugins.core.sensors.OverallBranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.OverallCoverageDecorator;
-import org.sonar.plugins.core.sensors.OverallLineCoverageDecorator;
-import org.sonar.plugins.core.sensors.ProfileEventsSensor;
-import org.sonar.plugins.core.sensors.ProfileSensor;
-import org.sonar.plugins.core.sensors.ProjectLinksSensor;
-import org.sonar.plugins.core.sensors.UnitTestDecorator;
-import org.sonar.plugins.core.sensors.VersionEventsSensor;
+import org.sonar.plugins.core.sensors.*;
import org.sonar.plugins.core.technicaldebt.TechnicalDebtDecorator;
-import org.sonar.plugins.core.timemachine.NewCoverageAggregator;
-import org.sonar.plugins.core.timemachine.NewCoverageFileAnalyzer;
-import org.sonar.plugins.core.timemachine.NewItCoverageFileAnalyzer;
-import org.sonar.plugins.core.timemachine.NewOverallCoverageFileAnalyzer;
-import org.sonar.plugins.core.timemachine.TendencyDecorator;
-import org.sonar.plugins.core.timemachine.TimeMachineConfigurationPersister;
-import org.sonar.plugins.core.timemachine.VariationDecorator;
+import org.sonar.plugins.core.timemachine.*;
import org.sonar.plugins.core.web.Lcom4Viewer;
import org.sonar.plugins.core.web.TestsViewer;
-import org.sonar.plugins.core.widgets.AlertsWidget;
-import org.sonar.plugins.core.widgets.ComplexityWidget;
-import org.sonar.plugins.core.widgets.CoverageWidget;
-import org.sonar.plugins.core.widgets.CustomMeasuresWidget;
-import org.sonar.plugins.core.widgets.DescriptionWidget;
-import org.sonar.plugins.core.widgets.DocumentationCommentsWidget;
-import org.sonar.plugins.core.widgets.DuplicationsWidget;
-import org.sonar.plugins.core.widgets.EventsWidget;
-import org.sonar.plugins.core.widgets.HotspotMetricWidget;
-import org.sonar.plugins.core.widgets.HotspotMostViolatedResourcesWidget;
-import org.sonar.plugins.core.widgets.HotspotMostViolatedRulesWidget;
-import org.sonar.plugins.core.widgets.ItCoverageWidget;
-import org.sonar.plugins.core.widgets.MeasureFilterListWidget;
-import org.sonar.plugins.core.widgets.MeasureFilterTreemapWidget;
-import org.sonar.plugins.core.widgets.RulesWidget;
-import org.sonar.plugins.core.widgets.SizeWidget;
-import org.sonar.plugins.core.widgets.TechnicalDebtPyramidWidget;
-import org.sonar.plugins.core.widgets.TechnicalDebtWidget;
-import org.sonar.plugins.core.widgets.TimeMachineWidget;
-import org.sonar.plugins.core.widgets.TimelineWidget;
-import org.sonar.plugins.core.widgets.TreemapWidget;
-import org.sonar.plugins.core.widgets.WelcomeWidget;
-import org.sonar.plugins.core.widgets.issues.ActionPlansWidget;
-import org.sonar.plugins.core.widgets.issues.FalsePositiveIssuesWidget;
-import org.sonar.plugins.core.widgets.issues.IssueFilterWidget;
-import org.sonar.plugins.core.widgets.issues.MyUnresolvedIssuesWidget;
-import org.sonar.plugins.core.widgets.issues.UnresolvedIssuesPerAssigneeWidget;
-import org.sonar.plugins.core.widgets.issues.UnresolvedIssuesStatusesWidget;
+import org.sonar.plugins.core.widgets.*;
+import org.sonar.plugins.core.widgets.issues.*;
import java.util.Arrays;
import java.util.List;
@@ -298,7 +224,7 @@ public final class CorePlugin extends SonarPlugin {
ItCoverageWidget.class,
DescriptionWidget.class,
ComplexityWidget.class,
- RulesWidget.class,
+ IssuesWidget.class,
SizeWidget.class,
EventsWidget.class,
CustomMeasuresWidget.class,
@@ -311,7 +237,6 @@ public final class CorePlugin extends SonarPlugin {
WelcomeWidget.class,
DocumentationCommentsWidget.class,
DuplicationsWidget.class,
- TechnicalDebtWidget.class,
TechnicalDebtPyramidWidget.class,
// dashboards
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtWidget.java
deleted file mode 100644
index 04bf27bda8c..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TechnicalDebtWidget.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 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.widgets;
-
-import org.sonar.api.web.UserRole;
-import org.sonar.api.web.WidgetCategory;
-
-@UserRole(UserRole.USER)
-@WidgetCategory("Technical Debt")
-public final class TechnicalDebtWidget extends CoreWidget {
-
- public TechnicalDebtWidget() {
- super("technical_debt", "Technical Debt", "/org/sonar/plugins/core/widgets/technical_debt.html.erb");
- }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/RulesWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssuesWidget.java
index 07d6da8143d..aa7dbb882ba 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/RulesWidget.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/IssuesWidget.java
@@ -17,14 +17,15 @@
* 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.widgets;
+package org.sonar.plugins.core.widgets.issues;
import org.sonar.api.web.WidgetCategory;
+import org.sonar.plugins.core.widgets.CoreWidget;
-@WidgetCategory({"Issues"})
-public class RulesWidget extends CoreWidget {
+@WidgetCategory({"Issues", "Technical Debt"})
+public class IssuesWidget extends CoreWidget {
- public RulesWidget() {
- super("rules", "Rules Compliance", "/org/sonar/plugins/core/widgets/rules.html.erb");
+ public IssuesWidget() {
+ super("rules", "Issues and Technical Debt", "/org/sonar/plugins/core/widgets/issues/issues.html.erb");
}
}
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
index 3283bc0cad7..7928916fbab 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
@@ -994,9 +994,11 @@ widget.events.all=All
widget.events.no_event=No event
widget.events.show_more=Show more
-widget.rules.name=Rules Compliance
-widget.rules.description=Reports issues and compliance index on coding standards.
+widget.rules.name=Issues and Technical Debt
+widget.rules.description=Reports issues and technical debt.
widget.rules.issues=Issues
+widget.rules.technical_debt=Technical Debt
+widget.rules.technical_debt.days=days
widget.rules.added=Added:
widget.rules.removed=Removed:
@@ -1156,11 +1158,6 @@ widget.measure_filter_treemap.property.heightInPercents.name=Height
widget.measure_filter_treemap.property.heightInPercents.description=Height in percents of width
widget.measure_filter_treemap.property.displayFilterDescription.name=Display filter description
-widget.technical_debt.name=Technical Debt
-widget.technical_debt.description=Displays the technical debt, also known as remediation cost.
-widget.technical_debt.days=days
-widget.technical_debt.no_info_available=No information available.
-
widget.technical_debt_pyramid.name=Technical Debt Pyramid
widget.technical_debt_pyramid.description=Displays the technical debt by characteristics. Characteristics located at the bottom should be addressed before those on top.
widget.technical_debt_pyramid.cost=Cost
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb
index 41b0f3911c0..609b414aff8 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb
@@ -1,5 +1,6 @@
<%
issues = @snapshot.measure('violations')
+ technical_debt = @snapshot.measure('sqale_index')
blocker_issues = @snapshot.measure('blocker_violations')
critical_issues = @snapshot.measure('critical_violations')
major_issues = @snapshot.measure('major_violations')
@@ -9,7 +10,7 @@
%>
<table width="100%">
<tr>
- <td valign="top">
+ <td width="50%" valign="top">
<div class="dashbox">
<h3><%= message('widget.rules.issues') -%></h3>
<div class="marginbottom10">
@@ -34,16 +35,26 @@
<% if estimated_cleared_issues && estimated_cleared_issues > 0 %>
<br/>
<span style="font-weight: bold">
- <%= message('widget.rules.removed') -%>&nbsp;
+ <%= message('widget.rules.removed') -%>&nbsp;ยท
<span class="varb"><%= number_with_precision(estimated_cleared_issues, :precision => 0) -%></span>
</span>
<% end %>
<% end %>
</div>
+ <% if technical_debt %>
+ <h3><%= message('widget.rules.technical_debt') -%></h3>
+ <div>
+ <span class="big">
+ <a href="<%= url_for_drilldown('sqale_index') -%>"><%= format_measure(technical_debt) -%></a>
+ </span>
+ <span><%= message('widget.rules.technical_debt.days') -%></span>
+ <span><%= dashboard_configuration.selected_period? ? format_variation(technical_debt) : trend_icon(technical_debt) -%></span>
+ </div>
+ <% end %>
</div>
</td>
- <td valign="top" nowrap>
+ <td width="50%" valign="top" nowrap>
<%
values = [blocker_issues, critical_issues, major_issues, minor_issues, info_issues]
if dashboard_configuration.selected_period?
@@ -63,6 +74,7 @@
<td>
<%= dashboard_configuration.selected_period? ? format_variation(blocker_issues) : trend_icon(blocker_issues, :empty => true) -%>
</td>
+ <td>&nbsp;</td>
<td align="left" style="padding-bottom:2px; padding-top:2px;">
<% if max > 0 %>
<% if dashboard_configuration.selected_period? %>
@@ -83,6 +95,7 @@
<td>
<%= dashboard_configuration.selected_period? ? format_variation(critical_issues) : trend_icon(critical_issues, :empty => true) -%>
</td>
+ <td>&nbsp;</td>
<td align="left" style="padding-bottom:2px; padding-top:2px;">
<% if max > 0 %>
<% if dashboard_configuration.selected_period? %>
@@ -103,6 +116,7 @@
<td>
<%= dashboard_configuration.selected_period? ? format_variation(major_issues) : trend_icon(major_issues, :empty => true) -%>
</td>
+ <td>&nbsp;</td>
<td align="left" style="padding-bottom:2px; padding-top:2px;">
<% if max > 0 %>
<% if dashboard_configuration.selected_period? %>
@@ -123,6 +137,7 @@
<td>
<%= dashboard_configuration.selected_period? ? format_variation(minor_issues) : trend_icon(minor_issues, :empty => true) -%>
</td>
+ <td>&nbsp;</td>
<td align="left" style="padding-bottom:2px; padding-top:2px;">
<% if max > 0 %>
<% if dashboard_configuration.selected_period? %>
@@ -143,6 +158,7 @@
<td>
<%= dashboard_configuration.selected_period? ? format_variation(info_issues) : trend_icon(info_issues, :empty => true) -%>
</td>
+ <td>&nbsp;</td>
<td align="left" style="padding-bottom:2px; padding-top:2px;">
<% if max > 0 %>
<% if dashboard_configuration.selected_period? %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt.html.erb
deleted file mode 100644
index 1e5f4b5c447..00000000000
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/technical_debt.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-<%
- index = measure('sqale_index')
- unless index && index.value
-%>
- <h3><%= message('widget.technical_debt.name') -%></h3>
- <span style="color: #777777; font-size: 93%; font-style:italic"><%= message('widget.technical_debt.no_info_available') -%></span>
-<%
- else
-%>
- <div class="dashbox marginright10">
- <h3><%= message('widget.technical_debt.name') -%></h3>
- <p>
- <a href="<%= url_for_drilldown('sqale_index') -%>">
- <span class="big"><%= number_with_precision(index.value, :precision => 1) -%></span>&nbsp;<%= message('widget.technical_debt.days') -%></a>
- <%= dashboard_configuration.selected_period? ? format_variation(index) : trend_icon(index) -%>
- </p>
- </div>
-<% end %>