summaryrefslogtreecommitdiffstats
path: root/plugins/sonar-design-plugin
diff options
context:
space:
mode:
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>2012-09-21 11:58:00 +0200
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>2012-09-21 11:58:00 +0200
commit66e7e4ef879dcc7c5f606ac0d600b409c451410b (patch)
tree30c418b65c79025029174b68e584e5873a3a392c /plugins/sonar-design-plugin
parent368737eb0438d232c7ac0e5f84b1e0e59832ab98 (diff)
downloadsonarqube-66e7e4ef879dcc7c5f606ac0d600b409c451410b.tar.gz
sonarqube-66e7e4ef879dcc7c5f606ac0d600b409c451410b.zip
SONAR-3591 Split the CKJM widget into two distinct widgets
Diffstat (limited to 'plugins/sonar-design-plugin')
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java7
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/LCOM4Widget.java43
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ResponseForClassWidget.java (renamed from plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ChidamberKemererWidget.java)12
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb56
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/lcom4.html.erb34
-rw-r--r--plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/response_for_class.html.erb30
6 files changed, 118 insertions, 64 deletions
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
index 50805055b42..ec4b774897c 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
@@ -30,14 +30,16 @@ import org.sonar.plugins.design.batch.SuspectLcom4DensityDecorator;
import org.sonar.plugins.design.ui.dependencies.DependenciesViewer;
import org.sonar.plugins.design.ui.libraries.GwtLibrariesPage;
import org.sonar.plugins.design.ui.page.GwtDesignPage;
-import org.sonar.plugins.design.ui.widgets.ChidamberKemererWidget;
import org.sonar.plugins.design.ui.widgets.FileDesignWidget;
+import org.sonar.plugins.design.ui.widgets.LCOM4Widget;
import org.sonar.plugins.design.ui.widgets.PackageDesignWidget;
+import org.sonar.plugins.design.ui.widgets.ResponseForClassWidget;
import java.util.List;
public class DesignPlugin extends SonarPlugin {
+ @SuppressWarnings("unchecked")
public List<Class<? extends Extension>> getExtensions() {
return ImmutableList.of(
// Batch
@@ -53,6 +55,7 @@ public class DesignPlugin extends SonarPlugin {
DependenciesViewer.class,
FileDesignWidget.class,
PackageDesignWidget.class,
- ChidamberKemererWidget.class);
+ LCOM4Widget.class,
+ ResponseForClassWidget.class);
}
}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/LCOM4Widget.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/LCOM4Widget.java
new file mode 100644
index 00000000000..4345edf37d4
--- /dev/null
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/LCOM4Widget.java
@@ -0,0 +1,43 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar 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.
+ *
+ * Sonar 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 Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.design.ui.widgets;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+import org.sonar.api.web.UserRole;
+import org.sonar.api.web.WidgetCategory;
+
+@UserRole(UserRole.USER)
+@WidgetCategory({"Design"})
+public final class LCOM4Widget extends AbstractRubyTemplate implements RubyRailsWidget {
+
+ public String getId() {
+ return "lcom4";
+ }
+
+ public String getTitle() {
+ return "LCOM4";
+ }
+
+ @Override
+ protected String getTemplatePath() {
+ return "/org/sonar/plugins/design/ui/widgets/lcom4.html.erb";
+ }
+}
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ChidamberKemererWidget.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ResponseForClassWidget.java
index 88db19e61d8..fe2b8d7ea4e 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ChidamberKemererWidget.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ResponseForClassWidget.java
@@ -25,19 +25,19 @@ import org.sonar.api.web.UserRole;
import org.sonar.api.web.WidgetCategory;
@UserRole(UserRole.USER)
-@WidgetCategory({ "Design" })
-public final class ChidamberKemererWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+@WidgetCategory({"Design"})
+public final class ResponseForClassWidget extends AbstractRubyTemplate implements RubyRailsWidget {
public String getId() {
- return "ckjm";
+ return "rfc";
}
public String getTitle() {
- return "Chidamber & Kemerer";
+ return "Response for class";
}
@Override
protected String getTemplatePath() {
- return "/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb";
+ return "/org/sonar/plugins/design/ui/widgets/response_for_class.html.erb";
}
-} \ No newline at end of file
+}
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb
deleted file mode 100644
index 7757aa18075..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb
+++ /dev/null
@@ -1,56 +0,0 @@
-<%
-lcom=measure('lcom4')
-rfc=measure('rfc')
-if lcom || rfc
- lcom_distribution=measure('lcom4_distribution')
- rfc_distribution=measure('rfc_distribution')
- suspect_lcom4_density=measure('suspect_lcom4_density')
- %>
-<table width="100%">
- <tbody>
- <tr>
- <% if lcom %>
- <td width="50%" valign="top">
- <div class="dashbox">
- <h3><%= message('widget.ckjm.lcom4') -%></h3>
- <p>
- <span class="big"><%= format_measure(lcom, :suffix => '', :default => '-', :url => url_for_drilldown('lcom4')) -%></span><%= message('widget.ckjm.per_class.suffix') -%> <%= dashboard_configuration.selected_period? ? format_variation(lcom) : trend_icon(lcom, :big => true) -%>
- </p>
- <p>
- <%= format_measure(suspect_lcom4_density, :suffix => message('widget.ckjm.files_having_lcom_greater_than_one'), :url => url_for_drilldown('lcom4')) %> <%= dashboard_configuration.selected_period? ? format_variation(suspect_lcom4_density) : trend_icon(suspect_lcom4_density) -%>
- </p>
- </div>
- </td>
- <% end %>
- <% if rfc %>
- <td width="50%" valign="top">
- <div class="dashbox">
- <h3><%= message('widget.ckjm.rfc') -%></h3>
- <p><span class="big">
- <%= format_measure(rfc, :suffix => '', :default => '-', :url => url_for_drilldown('rfc')) -%></span><%= message('widget.ckjm.per_class.suffix') -%> <%= dashboard_configuration.selected_period? ? format_variation(rfc) : trend_icon(rfc, :big => true) -%>
- </p>
- </div>
- </td>
- <% end %>
- </tr>
- <tr>
- <td>
- <%
- if suspect_lcom4_density && suspect_lcom4_density.value>1.0 && lcom_distribution && !lcom_distribution.data.blank?
- query="ck=distbar&c=777777&w=180&h=100&fs=8&bgc=ffffff&v=" + u(lcom_distribution.data)
- %>
- <a href="<%= url_for_drilldown('lcom4') -%>"><%= chart(query, :id => 'lcom4_distribution', :alt => '') -%></a>
- <% end %>
- </td>
- <td>
- <%
- if rfc_distribution && !rfc_distribution.data.blank?
- query="ck=distbar&c=777777&w=180&h=100&fs=8&bgc=ffffff&v=" + u(rfc_distribution.data)
- %>
- <a href="<%= url_for_drilldown('rfc') -%>"><%= chart(query, :id => 'rfc_distribution', :alt => '') -%></a>
- <% end %>
- </td>
- </tr>
- </tbody>
-</table>
-<% end %>
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/lcom4.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/lcom4.html.erb
new file mode 100644
index 00000000000..171d3e6175b
--- /dev/null
+++ b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/lcom4.html.erb
@@ -0,0 +1,34 @@
+<%
+ lcom=measure('lcom4')
+ if lcom
+ lcom_distribution=measure('lcom4_distribution')
+ suspect_lcom4_density=measure('suspect_lcom4_density')
+%>
+<table width="100%">
+ <tbody>
+ <tr>
+ <td valign="top">
+ <div class="dashbox">
+ <h3><%= message('widget.lcom4.title') -%></h3>
+ <p>
+ <span class="big"><%= format_measure(lcom, :suffix => '', :default => '-', :url => url_for_drilldown('lcom4')) -%></span><%= message('widget.lcom4.per_class.suffix') -%> <%= dashboard_configuration.selected_period? ? format_variation(lcom) : trend_icon(lcom, :big => true) -%>
+ </p>
+ <p>
+ <%= format_measure(suspect_lcom4_density, :suffix => message('widget.lcom4.files_having_lcom_greater_than_one'), :url => url_for_drilldown('lcom4')) %> <%= dashboard_configuration.selected_period? ? format_variation(suspect_lcom4_density) : trend_icon(suspect_lcom4_density) -%>
+ </p>
+ </div>
+ </td>
+
+ <%
+ if suspect_lcom4_density && suspect_lcom4_density.value>1.0 && lcom_distribution && !lcom_distribution.data.blank?
+ query="ck=distbar&c=777777&w=180&h=100&fs=8&bgc=ffffff&v=" + u(lcom_distribution.data)
+ %>
+ <td>
+ <a href="<%= url_for_drilldown('lcom4') -%>"><%= chart(query, :id => 'lcom4_distribution', :alt => '') -%></a>
+ </td>
+ <% end %>
+
+ </tr>
+ </tbody>
+</table>
+<% end %>
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/response_for_class.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/response_for_class.html.erb
new file mode 100644
index 00000000000..63a6fa6f55a
--- /dev/null
+++ b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/response_for_class.html.erb
@@ -0,0 +1,30 @@
+<%
+ rfc=measure('rfc')
+ if rfc
+ rfc_distribution=measure('rfc_distribution')
+%>
+<table width="100%">
+ <tbody>
+ <tr>
+ <td valign="top">
+ <div class="dashbox">
+ <h3><%= message('widget.rfc.title') -%></h3>
+ <p><span class="big">
+ <%= format_measure(rfc, :suffix => '', :default => '-', :url => url_for_drilldown('rfc')) -%></span><%= message('widget.rfc.per_class.suffix') -%> <%= dashboard_configuration.selected_period? ? format_variation(rfc) : trend_icon(rfc, :big => true) -%>
+ </p>
+ </div>
+ </td>
+
+ <%
+ if rfc_distribution && !rfc_distribution.data.blank?
+ query="ck=distbar&c=777777&w=180&h=100&fs=8&bgc=ffffff&v=" + u(rfc_distribution.data)
+ %>
+ <td>
+ <a href="<%= url_for_drilldown('rfc') -%>"><%= chart(query, :id => 'rfc_distribution', :alt => '') -%></a>
+ </td>
+ <% end %>
+
+ </tr>
+ </tbody>
+</table>
+<% end %>