]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4346 Move Documentation and Comments widget from Widget Lab plugin to Sonar...
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 9 Jul 2013 12:08:39 +0000 (14:08 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 9 Jul 2013 12:44:43 +0000 (14:44 +0200)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DocumentationCommentsWidget.java [new file with mode: 0644]
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb [new file with mode: 0644]

index 84d6b162235cfc9ed4eacc86561267b3ac47ddb8..ce3a0fb254fa93c0ecbbc7aa6ebea8ff5ff1b9ee 100644 (file)
@@ -369,6 +369,7 @@ public final class CorePlugin extends SonarPlugin {
       MeasureFilterListWidget.class,
       MeasureFilterTreemapWidget.class,
       WelcomeWidget.class,
+      DocumentationCommentsWidget.class,
 
       // dashboards
       ProjectDefaultDashboard.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DocumentationCommentsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DocumentationCommentsWidget.java
new file mode 100644 (file)
index 0000000..3b0ae1f
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+
+public class DocumentationCommentsWidget extends CoreWidget {
+
+  public DocumentationCommentsWidget() {
+    super("documentation_comments", "Documentation Metrics", "/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb");
+  }
+
+}
index ca77fe4f6ca5be00ac32d3cad08b9f966610f533..3c94a4082fa1a18289004c43c10eae3db1932940 100644 (file)
@@ -901,6 +901,15 @@ widget.comments_duplications.duplications=Duplications
 widget.comments_duplications.blocks.suffix=\ blocks
 widget.comments_duplications.files.suffix=\ files
 
+widget.documentation_comments.name=Documentation & Comments
+widget.documentation_comments.description=Reports on comments and documentation
+widget.documentation_comments.comments=Comments
+widget.documentation_comments.documentation=Documentation
+widget.documentation_comments.lines.suffix=\ lines
+widget.documentation_comments.docu_api.suffix=\ docu. API
+widget.documentation_comments.undocu_api.suffix=\ undocu. API
+widget.documentation_comments.public_api.suffix=\ Public API
+
 widget.complexity.name=Complexity
 widget.complexity.description=Reports on complexity, average complexity and complexity distribution.
 widget.complexity.per_method.suffix=\ /method
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb
new file mode 100644 (file)
index 0000000..6cdc141
--- /dev/null
@@ -0,0 +1,47 @@
+<%
+  comments=measure('comment_lines_density')
+  if comments
+%>
+<table width="100%">
+  <tbody>
+    <tr>
+      <td valign="top" width="50%">
+        <div class="dashbox">
+          <p class="title"><%= message('widget.documentation_comments.documentation') -%></p>
+          <p>
+            <span class="big">
+              <%= format_measure(measure('public_documented_api_density'),:url => url_for_drilldown('public_documented_api_density'), :suffix =>  ' ' + message('widget.documentation_comments.docu_api.suffix'))%>
+            </span>
+            <%= dashboard_configuration.selected_period? ? format_variation('public_documented_api_density') : trend_icon('public_documented_api_density') -%>
+          </p>
+          <p>
+            <%= format_measure(measure('public_api'),:url => url_for_drilldown('public_api'), :suffix =>  ' ' + message('widget.documentation_comments.public_api.suffix'))%>
+            <%= dashboard_configuration.selected_period? ? format_variation('public_api') : trend_icon('public_api') -%>
+          </p>
+          <p>
+            <%= format_measure(measure('public_undocumented_api'),:url => url_for_drilldown('public_undocumented_api'), :suffix => ' ' + message('widget.documentation_comments.undocu_api.suffix'))%>
+            <%= dashboard_configuration.selected_period? ? format_variation('public_undocumented_api') : trend_icon('public_undocumented_api') -%>
+          </p>
+        </div>
+      </td>
+      <td valign="top" width="50%">
+        <div class="dashbox">
+          <p class="title"><%= message('widget.documentation_comments.comments') -%></p>
+          <p>
+            <span class="big">
+              <%= format_measure('comment_lines_density',:url => url_for_drilldown('comment_lines_density'))%>
+            </span>
+            <%= dashboard_configuration.selected_period? ? format_variation('comment_lines_density') : trend_icon('comment_lines_density') -%>
+          </p>
+          <p>
+            <%= format_measure(measure('comment_lines'),:url => url_for_drilldown('comment_lines'), :suffix =>  ' ' + message('widget.documentation_comments.lines.suffix'))%>
+            <%= dashboard_configuration.selected_period? ? format_variation('comment_lines') : trend_icon('comment_lines') -%>
+          </p>
+        </div>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<%
+  end
+%>