aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-07-09 14:08:39 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-07-09 14:44:43 +0200
commita6063e012fb02d8537076d4a4bbc9fe137c72a56 (patch)
tree173d0e04722ffa91fb6e4ba5e5e61248d78efb9d /plugins
parent30d68e219bdfddc1d8a22058ff99a048d16938d1 (diff)
downloadsonarqube-a6063e012fb02d8537076d4a4bbc9fe137c72a56.tar.gz
sonarqube-a6063e012fb02d8537076d4a4bbc9fe137c72a56.zip
SONAR-4346 Move Documentation and Comments widget from Widget Lab plugin to Sonar Core
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java1
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DocumentationCommentsWidget.java29
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties9
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb47
4 files changed, 86 insertions, 0 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 84d6b162235..ce3a0fb254f 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
@@ -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
index 00000000000..3b0ae1f90f7
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DocumentationCommentsWidget.java
@@ -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");
+ }
+
+}
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 ca77fe4f6ca..3c94a4082fa 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
@@ -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
index 00000000000..6cdc14165ac
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb
@@ -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
+%>