]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2721 Display number of "projects" in "Size" widget
authorEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 19 Mar 2012 05:45:15 +0000 (09:45 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 19 Mar 2012 06:31:32 +0000 (10:31 +0400)
Thus add new metric - 'projects'.

plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java

index e6366b32bc82c63340416817666edd15a53aa74a..298a1314ab71cfff35835b4d125fdac7d59f3896 100644 (file)
@@ -5,6 +5,7 @@
   files=measure('files')
   packages=measure('packages')
   functions=measure('functions')
+  projects=measure('projects')
   if measure('lines') || ncloc
     files=measure('files')
     statements=measure('statements')
@@ -43,6 +44,9 @@
         <% if files && measure('classes') %>
           <p><%= format_measure(files, :suffix => message('widget.size.files.suffix'), :url => url_for_drilldown(files)) -%> <%= dashboard_configuration.selected_period? ? format_variation(files) : trend_icon(files) -%></p>
         <% end %>
+        <% if projects %>
+          <p><%= format_measure(projects, :suffix => message('widget.size.projects.suffix'), :url => url_for_drilldown(projects)) -%> <%= dashboard_configuration.selected_period? ? format_variation(projects) : trend_icon(projects) -%></p>
+        <% end %>
       </div>
     </td>
     <td width="10"> </td>
index 2f3e06c1be65bb9606549f6460805931a1693f37..d41cd3320c90d18f6999ee2b8ea8810d55725eff 100644 (file)
@@ -669,6 +669,7 @@ widget.size.directories.suffix=\ directories
 widget.size.methods.suffix=\ methods
 widget.size.accessors.suffix=\ accessors
 widget.size.paragraphs.suffix=\ paragraphs
+widget.size.projects.suffix=\ projects
 
 widget.timeline.name=Timeline
 widget.timeline.description=Displays up to 3 metrics on a history chart.
index 01356c325e7f8e1b73ed52deb20c1e499c2606cc..47fa9a861f4779d16fff6a91f46837dac45ec8dc 100644 (file)
@@ -183,6 +183,20 @@ public final class CoreMetrics {
       .setFormula(new SumChildValuesFormula(false))
       .create();
 
+  /**
+   * @since 2.15
+   */
+  public static final String PROJECTS_KEY = "projects";
+
+  /**
+   * @since 2.15
+   */
+  public static final Metric PROJECTS = new Metric.Builder(PROJECTS_KEY, "Projects", Metric.ValueType.INT)
+      .setDescription("Number of projects")
+      .setDirection(Metric.DIRECTION_WORST)
+      .setQualitative(false)
+      .setDomain(DOMAIN_SIZE)
+      .create();
 
   //--------------------------------------------------------------------------------------------------------------------
   //