]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3591 Split the CKJM widget into two distinct widgets
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Fri, 21 Sep 2012 09:58:00 +0000 (11:58 +0200)
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Fri, 21 Sep 2012 09:58:00 +0000 (11:58 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ChidamberKemererWidget.java [deleted file]
plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/LCOM4Widget.java [new file with mode: 0644]
plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ResponseForClassWidget.java [new file with mode: 0644]
plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb [deleted file]
plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/lcom4.html.erb [new file with mode: 0644]
plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/response_for_class.html.erb [new file with mode: 0644]

index a8210dbff9f9cbe5e33194b2d44d620e28acee28..d684f7b7e5932bf05ea75e6bbae077b652493c3b 100644 (file)
@@ -718,13 +718,6 @@ widget.timeline.timeline_not_displayed=No history
 widget.time_machine.name=History Table
 widget.time_machine.description=Displays up to 10 metrics in a table, showing their value for a specified number of past snapshots.
 
-widget.ckjm.name=Chidamber & Kemerer
-widget.ckjm.description=Reports on LCOM4 and RFC average and distribution.
-widget.ckjm.lcom4=LCOM4
-widget.ckjm.per_class.suffix=\ /class
-widget.ckjm.files_having_lcom_greater_than_one=\ files having LCOM4>1
-widget.ckjm.rfc=Response for Class
-
 widget.file_design.name=File design
 widget.file_design.description=Reports on files dependency cycles and tangle index.
 widget.file_design.file_tangle_index=File tangle index
@@ -800,6 +793,17 @@ widget.filter.name=Filter
 widget.filter.description=Shows a pre-configured filter
 widget.filter.edit=Edit my filters
 
+widget.lcom4.name=LCOM4
+widget.lcom4.description=Reports on LCOM4 average and distribution.
+widget.lcom4.title=LCOM4
+widget.lcom4.per_class.suffix=\ /class
+widget.lcom4.files_having_lcom_greater_than_one=\ files having LCOM4>1
+
+widget.rfc.name=Response for class
+widget.rfc.description=Reports on RFC average and distribution.
+widget.rfc.title=Response for Class
+widget.rfc.per_class.suffix=\ /class
+
 widget.resource_id=project
 
 #------------------------------------------------------------------------------
index 50805055b42ed0d449047e6782860023bda0a65f..ec4b774897cc00588c9e143dd63bd16a60a90460 100644 (file)
@@ -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/ChidamberKemererWidget.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ChidamberKemererWidget.java
deleted file mode 100644 (file)
index 88db19e..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 ChidamberKemererWidget extends AbstractRubyTemplate implements RubyRailsWidget {
-
-  public String getId() {
-    return "ckjm";
-  }
-
-  public String getTitle() {
-    return "Chidamber & Kemerer";
-  }
-
-  @Override
-  protected String getTemplatePath() {
-    return "/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb";
-  }
-}
\ No newline at end of file
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 (file)
index 0000000..4345edf
--- /dev/null
@@ -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/ResponseForClassWidget.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/widgets/ResponseForClassWidget.java
new file mode 100644 (file)
index 0000000..fe2b8d7
--- /dev/null
@@ -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 ResponseForClassWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+
+  public String getId() {
+    return "rfc";
+  }
+
+  public String getTitle() {
+    return "Response for class";
+  }
+
+  @Override
+  protected String getTemplatePath() {
+    return "/org/sonar/plugins/design/ui/widgets/response_for_class.html.erb";
+  }
+}
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 (file)
index 7757aa1..0000000
+++ /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 (file)
index 0000000..171d3e6
--- /dev/null
@@ -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 (file)
index 0000000..63a6fa6
--- /dev/null
@@ -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 %>