diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-10-28 08:02:18 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-10-28 08:02:18 +0000 |
commit | ec7f0817eed5c7824bb2145c6bd520ab480ba3b9 (patch) | |
tree | a05550c2d4f7004ddafee228c6b07d932a680d8c /plugins | |
parent | 91493e94947de67103dea121e894b89fda37f767 (diff) | |
download | sonarqube-ec7f0817eed5c7824bb2145c6bd520ab480ba3b9.tar.gz sonarqube-ec7f0817eed5c7824bb2145c6bd520ab480ba3b9.zip |
SONAR-1643 apply a part of the GSOC branch
Diffstat (limited to 'plugins')
15 files changed, 723 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 2fa67c2613a..e96985a92cb 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 @@ -39,6 +39,7 @@ import org.sonar.plugins.core.sensors.*; import org.sonar.plugins.core.testdetailsviewer.TestsViewerDefinition; import org.sonar.plugins.core.ui.pageselector.GwtPageSelector; import org.sonar.plugins.core.violationsviewer.ViolationsViewerDefinition; +import org.sonar.plugins.core.widgets.*; import java.util.ArrayList; import java.util.List; @@ -143,6 +144,15 @@ public class CorePlugin implements Plugin { extensions.add(Clouds.class); extensions.add(Hotspots.class); + //widgets + extensions.add(DefaultAlertsWidget.class); + extensions.add(DefaultCodeCoverageWidget.class); + extensions.add(DefaultCommentsDuplicationsWidget.class); + extensions.add(DefaultDescriptionWidget.class); + extensions.add(DefaultExtendedAnalysisWidget.class); + extensions.add(DefaultRulesWidget.class); + extensions.add(DefaultStaticAnalysisWidget.class); + // chart extensions.add(XradarChart.class); extensions.add(DistributionBarChart.class); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultAlertsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultAlertsWidget.java new file mode 100644 index 00000000000..b826b83fdd7 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultAlertsWidget.java @@ -0,0 +1,39 @@ +/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.core.widgets;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+
+public class DefaultAlertsWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+ public String getId() {
+ return "alerts";
+ }
+
+ public String getTitle() {
+ // not used for the moment by widgets.
+ return "Alerts";
+ }
+
+ @Override
+ protected String getTemplatePath() {
+ return "/org/sonar/plugins/core/widgets/_alerts.html.erb";
+ }
+}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCodeCoverageWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCodeCoverageWidget.java new file mode 100644 index 00000000000..88471b2f755 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCodeCoverageWidget.java @@ -0,0 +1,39 @@ +/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.core.widgets;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+
+public class DefaultCodeCoverageWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+ public String getId() {
+ return "code_coverage";
+ }
+
+ public String getTitle() {
+ // not used for the moment by widgets.
+ return "Code coverage";
+ }
+
+ @Override
+ protected String getTemplatePath() {
+ return "/org/sonar/plugins/core/widgets/_code_coverage.html.erb";
+ }
+}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCommentsDuplicationsWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCommentsDuplicationsWidget.java new file mode 100644 index 00000000000..8d1a8da9eec --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultCommentsDuplicationsWidget.java @@ -0,0 +1,39 @@ +/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.core.widgets;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+
+public class DefaultCommentsDuplicationsWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+ public String getId() {
+ return "comments_duplications";
+ }
+
+ public String getTitle() {
+ // not used for the moment by widgets.
+ return "Comments duplications";
+ }
+
+ @Override
+ protected String getTemplatePath() {
+ return "/org/sonar/plugins/core/widgets/_comments_duplications.html.erb";
+ }
+}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultDescriptionWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultDescriptionWidget.java new file mode 100644 index 00000000000..455fe019dd7 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultDescriptionWidget.java @@ -0,0 +1,39 @@ +/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.core.widgets;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+
+public class DefaultDescriptionWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+ public String getId() {
+ return "description";
+ }
+
+ public String getTitle() {
+ // not used for the moment by widgets.
+ return "Description";
+ }
+
+ @Override
+ protected String getTemplatePath() {
+ return "/org/sonar/plugins/core/widgets/_description.html.erb";
+ }
+}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultExtendedAnalysisWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultExtendedAnalysisWidget.java new file mode 100644 index 00000000000..516b910653c --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultExtendedAnalysisWidget.java @@ -0,0 +1,39 @@ +/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.core.widgets;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+
+public class DefaultExtendedAnalysisWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+ public String getId() {
+ return "extended_analysis";
+ }
+
+ public String getTitle() {
+ // not used for the moment by widgets.
+ return "Extended analysis";
+ }
+
+ @Override
+ protected String getTemplatePath() {
+ return "/org/sonar/plugins/core/widgets/_extended_analysis.html.erb";
+ }
+}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultRulesWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultRulesWidget.java new file mode 100644 index 00000000000..f2985fa6ccf --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultRulesWidget.java @@ -0,0 +1,39 @@ +/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.core.widgets;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+
+public class DefaultRulesWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+ public String getId() {
+ return "rules";
+ }
+
+ public String getTitle() {
+ // not used for the moment by widgets.
+ return "Rules";
+ }
+
+ @Override
+ protected String getTemplatePath() {
+ return "/org/sonar/plugins/core/widgets/_rules.html.erb";
+ }
+}
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultStaticAnalysisWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultStaticAnalysisWidget.java new file mode 100644 index 00000000000..9c10430c774 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/DefaultStaticAnalysisWidget.java @@ -0,0 +1,39 @@ +/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.core.widgets;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+
+public class DefaultStaticAnalysisWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+ public String getId() {
+ return "static_analysis";
+ }
+
+ public String getTitle() {
+ // not used for the moment by widgets.
+ return "Static analysis";
+ }
+
+ @Override
+ protected String getTemplatePath() {
+ return "/org/sonar/plugins/core/widgets/_static_analysis.html.erb";
+ }
+}
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_alerts.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_alerts.html.erb new file mode 100644 index 00000000000..095afb59331 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_alerts.html.erb @@ -0,0 +1,10 @@ +<% m=measure(Metric::ALERT_STATUS) + if m && !m.alert_status.blank? + css_class = "widget color_#{m.alert_status}" + if m.alert_status==Metric::TYPE_LEVEL_OK + label = '<b>No alerts</b>.' + else + label = "<b>Alerts</b> : #{h(m.alert_text)}." + end +%> <div><%= format_measure(m) -%> <%= label -%></div> +<% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_code_coverage.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_code_coverage.html.erb new file mode 100644 index 00000000000..02b1dc5ef5a --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_code_coverage.html.erb @@ -0,0 +1,45 @@ +<% +code_coverage_measure=measure(Metric::COVERAGE) +tests_measure=measure(Metric::TESTS) +if code_coverage_measure || tests_measure %> +<div class="yui-g"> + <div class="yui-u first"> +<div class="dashbox"> + <p class="title">Code coverage</p> + <p><span class="big"><%= format_measure(code_coverage_measure, :suffix => '', :url => url_for_drilldown(Metric::COVERAGE), :default => '-') %> <%= tendency_icon(code_coverage_measure, false) %></span></p> + <% line_coverage=measure(Metric::LINE_COVERAGE) + if line_coverage %> + <p><%= format_measure(line_coverage, :suffix => ' line coverage', :url => url_for_drilldown(Metric::UNCOVERED_LINES, :highlight => Metric::LINE_COVERAGE)) %> <%= tendency_icon(line_coverage) %></p> + <% end %> + <% branch_coverage=measure(Metric::BRANCH_COVERAGE) + if branch_coverage %> + <p><%= format_measure(branch_coverage, :suffix => ' branch coverage', :url => url_for_drilldown(Metric::UNCOVERED_CONDITIONS, :highlight => Metric::BRANCH_COVERAGE)) %> <%= tendency_icon(branch_coverage) %></p> + <% end %> + <p><%= format_measure(tests_measure, :suffix => ' tests', :url => url_for_drilldown(Metric::TESTS)) %> <%= tendency_icon(tests_measure) %></p> + <% skipped_measure=measure(Metric::SKIPPED_TESTS) + if skipped_measure && skipped_measure.value>0 + %> + <p>+<%= format_measure(skipped_measure, :suffix => ' skipped', :url => url_for_drilldown(Metric::SKIPPED_TESTS)) %> <%= tendency_icon(skipped_measure) %></p> + <% end %> + <p><%= format_measure(Metric::TEST_EXECUTION_TIME, :suffix => '', :url => url_for_drilldown(Metric::TEST_EXECUTION_TIME)) %> <%= tendency_icon(measure(Metric::TEST_EXECUTION_TIME)) %></p> +</div> +</div> +<div class="yui-u"> + <% + success_percentage=measure(Metric::TEST_SUCCESS_DENSITY) + if success_percentage + %> + <div class="dashbox"> + <h3>Test success</h3> + <p><span class="big"><%= format_measure(success_percentage, :suffix => '', :url => url_for_drilldown(success_percentage)) %> <%= tendency_icon(measure(Metric::TEST_SUCCESS_DENSITY), false) %></span></p> + <p> + <%= format_measure(Metric::TEST_FAILURES, :suffix => ' failures', :url => url_for_drilldown(Metric::TEST_FAILURES)) %> <%= tendency_icon(measure(Metric::TEST_FAILURES)) %> + </p> + <p> + <%= format_measure(Metric::TEST_ERRORS, :suffix => ' errors', :url => url_for_drilldown(Metric::TEST_ERRORS)) %> <%= tendency_icon(measure(Metric::TEST_ERRORS)) %> + </p> + </div> + <% end %> +</div> +</div> +<% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_comments_duplications.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_comments_duplications.html.erb new file mode 100644 index 00000000000..b7b7e2f54cd --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_comments_duplications.html.erb @@ -0,0 +1,37 @@ +<% if measure(Metric::LINES) || measure(Metric::NCLOC) %> +<table width="100%"> + <tr> + <td valign="top" width="48%" nowrap> + <% if (measure(Metric::COMMENT_LINES)) %> + <div class="dashbox"> + <h3>Comments</h3> + <p><span class="big"><%= format_measure(Metric::COMMENT_LINES_DENSITY, :suffix => '', :url => url_for_drilldown(Metric::COMMENT_LINES_DENSITY)) -%> <%= tendency_icon(Metric::COMMENT_LINES_DENSITY, false) -%></span></p> + <p><%= format_measure(Metric::COMMENT_LINES, :suffix => ' lines', :url => url_for_drilldown(Metric::COMMENT_LINES)) -%> <%= tendency_icon(Metric::COMMENT_LINES) -%></p> + <% + comment_blank_lines=measure('comment_blank_lines') + if comment_blank_lines && comment_blank_lines.value>0 + %> + <p>+<%= format_measure(comment_blank_lines, :suffix => ' blank', :url => url_for_drilldown(comment_blank_lines)) -%> <%= tendency_icon(comment_blank_lines) -%></p> + <% end %> + <p><%= format_measure(Metric::PUBLIC_DOCUMENTED_API_DENSITY, :suffix => ' docu. API', :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_DOCUMENTED_API_DENSITY)) -%> <%= tendency_icon(Metric::PUBLIC_DOCUMENTED_API_DENSITY) -%></p> + <p><%= format_measure(Metric::PUBLIC_UNDOCUMENTED_API, :suffix => ' undocu. API', :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_UNDOCUMENTED_API)) -%> <%= tendency_icon(Metric::PUBLIC_UNDOCUMENTED_API) -%></p> + <p><%= format_measure(Metric::COMMENTED_OUT_CODE_LINES, :suffix => ' commented LOCs', :url => url_for_drilldown(Metric::COMMENTED_OUT_CODE_LINES, :highlight => Metric::COMMENTED_OUT_CODE_LINES)) -%> <%= tendency_icon(Metric::COMMENTED_OUT_CODE_LINES) -%></p> + </div> + <% end %> + </td> + <td width="10"> </td> + <td valign="top"> + <% if (measure(Metric::DUPLICATED_LINES_DENSITY)) %> + <div class="dashbox"> + <h3>Duplications</h3> + <p><span class="big"><%= format_measure(Metric::DUPLICATED_LINES_DENSITY, :suffix => '', :url => url_for_drilldown(Metric::DUPLICATED_LINES, :highlight => Metric::DUPLICATED_LINES_DENSITY)) -%> <%= tendency_icon(Metric::DUPLICATED_LINES_DENSITY, false) -%></span></p> + <p><%= format_measure(Metric::DUPLICATED_LINES, :suffix => ' lines', :url => url_for_drilldown(Metric::DUPLICATED_LINES)) -%> <%= tendency_icon(Metric::DUPLICATED_LINES) -%></p> + <p><%= format_measure(Metric::DUPLICATED_BLOCKS, :suffix => ' blocks', :url => url_for_drilldown(Metric::DUPLICATED_BLOCKS)) -%> <%= tendency_icon(Metric::DUPLICATED_BLOCKS) -%></p> + <p><%= format_measure(Metric::DUPLICATED_FILES, :suffix => ' files', :url => url_for_drilldown(Metric::DUPLICATED_FILES)) -%> <%= tendency_icon(Metric::DUPLICATED_FILES) -%></p> + </div> + <% end %> + + </td> + </tr> +</table> +<% end %>
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_description.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_description.html.erb new file mode 100644 index 00000000000..8ae52acc63b --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_description.html.erb @@ -0,0 +1,27 @@ + <% if not @project.description.blank? %> + <%= h @project.description %><br/> + <% end %> + + Key : <%= @project.key %><br/> +<% if @project.language %> + Language : <%= @project.language %><br/> +<% end %> + + <table width="100%"> + <% links_count=@project.project_links.size + if links_count > 0 %> + <tr><td width="50%"> + <% @project.project_links.sort.each_with_index do |link, index| %> + <% if index==links_count/2 %></td><td width="50%"><% end %> + <%= link_to(image_tag(link.icon, :alt => link.name), link.href , :popup => true, :class => 'nolink') -%> + <%= link_to(h(link.name), link.href, :popup => true) -%><br/> + <% end %> + </td></tr> + <% end %> + <% if Project::SCOPE_SET==@project.scope %> + <tr><td colspan="2"> + <a href="<%= url_for :controller => :feeds, :action => 'project', :id => @project.key, :category => EventCategory::KEY_ALERT -%>" class="nolink"><%= image_tag 'feed-icon-14x14.png' %></a> + <a href="<%= url_for :controller => :feeds, :action => 'project', :id => @project.key, :category => EventCategory::KEY_ALERT -%>" class="action">Alerts feed</a> + </td></tr> + <% end %> + </table> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_extended_analysis.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_extended_analysis.html.erb new file mode 100644 index 00000000000..230633d4e24 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_extended_analysis.html.erb @@ -0,0 +1,126 @@ +<% + file_complexity=measure('file_complexity') + function_complexity=measure('function_complexity') + class_complexity=measure('class_complexity') + paragraph_complexity=measure('paragraph_complexity') + + if file_complexity || function_complexity || class_complexity || paragraph_complexity + complexity=measure('complexity') +%> +<div class="dashbox" > + <h3>Complexity</h3> + <% if function_complexity %> + <p> + <span class="big"><%= format_measure(function_complexity, :suffix => '', :url => url_for_drilldown(function_complexity)) -%> <%= tendency_icon(function_complexity, false) -%></span>/ method + </p> + <% end %> + <% if paragraph_complexity %> + <p> + <span class="big"><%= format_measure(paragraph_complexity, :suffix => '', :url => url_for_drilldown(paragraph_complexity)) -%> <%= tendency_icon(paragraph_complexity, false) -%></span>/ paragraph + </p> + <% end %> + <% if class_complexity %> + <p> + <span class="big"><%= format_measure(class_complexity, :suffix => '', :url => url_for_drilldown(class_complexity)) -%> <%= tendency_icon(class_complexity, false) -%></span>/ class + </p> + <% end %> + <% if file_complexity %> + <p> + <span class="big"><%= format_measure(file_complexity, :suffix => '', :url => url_for_drilldown(file_complexity)) -%> <%= tendency_icon(file_complexity, false) -%></span>/ file + </p> + <% end %> + <% if complexity %> + <p> + Total: <%= format_measure(complexity, :url => url_for_drilldown(complexity)) -%> <%= tendency_icon(complexity) -%> + </p> + <% end %> +</div> + + +<% + function_distribution=measure('function_complexity_distribution') + paragraph_distribution=measure('paragraph_complexity_distribution') + class_distribution=measure('class_complexity_distribution') + file_distribution=measure('file_complexity_distribution') + distributions=[function_distribution,paragraph_distribution,class_distribution,file_distribution].compact + selected_distribution=nil + if distributions.size>0 + selected_distribution=distributions.first + end + if selected_distribution +%> +<div class="dashbox" id="cmp_charts" style="float:right"> + <script type='text/javascript'> + //<![CDATA[ + function selectComplexity(metric) { + $$('#cmp_charts .chart').each(function(chart) { + chart.hide(); + }); + $('chart_' + metric).show(); + } + </script> + <style> + #cmp_charts form { + font-size: 93%;padding-left: 30px; + } + #cmp_charts form label { + padding-right: 5px; + } + </style> + <% distributions.each do |distribution_measure| %> + <% metric = distribution_measure.metric.key + dist_measure = measure(metric) + title = distribution_measure.metric.description + visible = (selected_distribution==distribution_measure) + if dist_measure && !dist_measure.data.blank? + %> + <div id="chart_<%= metric -%>" class="chart" style="display: <%= visible ? "block" : "none" %>"> + <% + query="ck=distbar&c=777777&v=" + u(dist_measure.data) + small_size_query=query + '&w=220&h=100&fs=8&bgc=ffffff' + big_size_query=query + '&w=300&h=150&fs=12&bgc=CAE3F2' + %><%= chart(small_size_query, :id => 'chart_img_' + metric, :alt => title) -%> + + <script type='text/javascript'> + //<![CDATA[ + new Tip('chart_img_<%=metric-%>', '<div style="width:300px;"><b><%= title -%></b><br>' + + '<%= chart(big_size_query, :id => 'chart_img_' + metric, :alt => title) -%></div>'); + //]]> + </script> + </div> + <% end %> + <% end %> + + <form> + <% + count_dist=0 + if function_distribution + count_dist+=1 + %> + <input type="radio" name="cmp_dist" value="function_complexity_distribution" id="cmp_dist_function_complexity_distribution" onClick="selectComplexity('function_complexity_distribution');" <%= 'checked' if function_distribution==selected_distribution -%>></input> <label for="cmp_dist_function_complexity_distribution">Methods</label> + <% + end + if paragraph_distribution + count_dist+=1 + %> + <input type="radio" name="cmp_dist" value="paragraph_complexity_distribution" id="cmp_dist_paragraph_complexity_distribution" onClick="selectComplexity('paragraph_complexity_distribution');" <%= 'checked' if paragraph_distribution==selected_distribution -%>></input> <label for="cmp_dist_paragraph_complexity_distribution">Paragraphs</label><%= '<br/>' if count_dist==2 %> + <% + end + if class_distribution + count_dist+=1 + %> + <input type="radio" name="cmp_dist" value="class_complexity_distribution" id="cmp_dist_class_complexity_distribution" onClick="selectComplexity('class_complexity_distribution');" <%= 'checked' if class_distribution==selected_distribution -%>></input> <label for="cmp_dist_class_complexity_distribution">Classes</label><%= '<br/>' if count_dist==2 %> + <% + end + if file_distribution + count_dist+=1 + %> + <input type="radio" name="cmp_dist" value="file_complexity_distribution" id="cmp_dist_file_complexity_distribution" onClick="selectComplexity('file_complexity_distribution');" <%= 'checked' if file_distribution==selected_distribution -%>></input> <label for="cmp_dist_file_complexity_distribution">Files</label> + <% end %> + + </form> + +</div> +<% end %> +<% end %> + diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_rules.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_rules.html.erb new file mode 100644 index 00000000000..7befce2e792 --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_rules.html.erb @@ -0,0 +1,132 @@ +<% if measure(Metric::LINES) %> + <table width="100%"> + <tr> + <td valign="top"> + <div class="dashbox"> + <h3>Rules compliance</h3> + <div class="big"> + <%= format_measure(Metric::VIOLATIONS_DENSITY, :url => url_for_drilldown(Metric::WEIGHTED_VIOLATIONS, {:highlight => Metric::WEIGHTED_VIOLATIONS})) -%> <%= tendency_icon(Metric::VIOLATIONS_DENSITY) -%> + </div> + <% + maintainability=@snapshot.measure(Metric::MAINTAINABILITY) + efficiency=@snapshot.measure(Metric::EFFICIENCY) + usability=@snapshot.measure(Metric::USABILITY) + reliability=@snapshot.measure(Metric::RELIABILITY) + portability=@snapshot.measure(Metric::PORTABILITY) + %> + <div class="mandatory"> + <a class="tip" href="<%= url_for :controller => 'drilldown', :action => 'violations', :id => @project.id, :filter => 'category' -%>"> + <img width="140" height="110" alt="" src="<%= ApplicationController.root_context -%>/chart?ck=xradar&w=140&h=110&c=777777|F8A036&m=100&g=0.25&l=Eff.,Mai.,Por.,Rel.,Usa.&v=<%= efficiency ? efficiency.value : 0 -%>,<%= maintainability ? maintainability.value : 0 -%>,<%= portability ? portability.value : 0 -%>,<%= reliability ? reliability.value : 0 -%>,<%= usability ? usability.value : 0 -%>"> + <span> + <table> + <tr> + <td align="left" nowrap>Efficiency </td> + <td align="right" id="m_efficiency"><%= formatted_value(efficiency) %></td> + <td nowrap> <%= tendency_icon(efficiency) -%></td> + </tr> + <tr> + <td align="left" nowrap>Maintainability </td> + <td align="right" id="m_maintainability"><%= formatted_value(maintainability) %></td> + <td nowrap> <%= tendency_icon(maintainability) -%></td> + </tr> + <tr> + <td align="left" nowrap>Portability </td> + <td align="right" id="m_portability"><%= formatted_value(portability) %></td> + <td nowrap> <%= tendency_icon(portability) -%></td> + </tr> + <tr> + <td align="left" nowrap>Reliability </td> + <td align="right" id="m_reliability"><%= formatted_value(reliability) %></td> + <td nowrap> <%= tendency_icon(reliability) -%></td> + </tr> + <tr> + <td align="left" nowrap>Usability </td> + <td align="right" id="m_usability"><%= formatted_value(usability) %></td> + <td nowrap> <%= tendency_icon(usability) -%></td> + </tr> + </table> + </span> + </a> + </div> + </div> + </td> + <td width="10"> </td> + <td valign="top"> + <div class="dashbox"> + <h3>Violations</h3> + <div class="big"> + <%= format_measure(Metric::VIOLATIONS, :url => url_for(:controller => 'drilldown', :action => 'violations', :id => @project.key)) -%> <%= tendency_icon(Metric::VIOLATIONS) -%> + </div> + <% + blocker_violations = @snapshot.measure(Metric::BLOCKER_VIOLATIONS) + critical_violations = @snapshot.measure(Metric::CRITICAL_VIOLATIONS) + major_violations = @snapshot.measure(Metric::MAJOR_VIOLATIONS) + minor_violations = @snapshot.measure(Metric::MINOR_VIOLATIONS) + info_violations = @snapshot.measure(Metric::INFO_VIOLATIONS) + max = 0 + [blocker_violations,critical_violations,major_violations,minor_violations,info_violations].each do |m| + max = m.value if m and m.value and m.value>max + end + %> + <table> + <tr> + <td><%= image_tag 'priority/BLOCKER.png'%></td> + <td> <%= link_to 'Blocker', {:controller => 'drilldown', :action => 'violations', :id => @project.key, :priority => 'BLOCKER'} %></td> + <td style="padding-left: 10px;" align="right"> + <%= format_measure(blocker_violations) -%> + </td> + <td width="1%"><%= tendency_icon(blocker_violations) -%></td> + <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <%= barchart(:width => 60, :percent => (blocker_violations ? (100 * blocker_violations.value / max).to_i : 0), :color => '#777777') if max>0 %> + </td> + </tr> + <tr> + <td><%= image_tag 'priority/CRITICAL.png' %></td> + <td> <%= link_to 'Critical', {:controller => 'drilldown', :action => 'violations', :id => @project.key, :priority => 'CRITICAL'} %></td> + <td style="padding-left: 10px;" align="right"> + <%= format_measure(critical_violations) -%> + </td> + <td width="1%"><%= tendency_icon(critical_violations) -%></td> + <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <%= barchart(:width => 60, :percent => (critical_violations ? (100 * critical_violations.value / max).to_i : 0), :color => '#777777') if max>0 %> + </td> + </tr> + <tr> + <td><%= image_tag 'priority/MAJOR.png' %></td> + <td> <%= link_to 'Major', {:controller => 'drilldown', :action => 'violations', :id => @project.key, :priority => 'MAJOR'} %></td> + <td style="padding-left: 10px;" align="right"> + <%= format_measure(major_violations) -%> + </td> + <td width="1%"><%= tendency_icon(major_violations) -%></td> + <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <%= barchart(:width => 60, :percent => (major_violations ? (100 * major_violations.value / max).to_i : 0), :color => '#777777') if max>0 %> + </td> + </tr> + <tr> + <td><%= image_tag 'priority/MINOR.png' %></td> + <td> <%= link_to 'Minor', {:controller => 'drilldown', :action => 'violations', :id => @project.key, :priority => 'MINOR'} %></td> + <td style="padding-left: 10px;" align="right"> + <%= format_measure(minor_violations) -%> + </td> + <td width="1%"><%= tendency_icon(minor_violations) -%></td> + <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <%= barchart(:width => 60, :percent => (minor_violations ? (100 * minor_violations.value / max).to_i : 0), :color => '#777777') if max>0 %> + </td> + </tr> + <tr> + <td><%= image_tag 'priority/INFO.png' %></td> + <td> <%= link_to 'Info', {:controller => 'drilldown', :action => 'violations', :id => @project.key, :priority => 'INFO'} %></td> + <td style="padding-left: 10px;" align="right"> + <%= format_measure(info_violations) -%> + </td> + <td width="1%"><%= tendency_icon(info_violations) -%></td> + <td align="left" style="padding-bottom:2px; padding-top:2px;"> + <%= barchart(:width => 60, :percent => (info_violations ? (100 * info_violations.value / max).to_i : 0), :color => '#777777') if max>0 %> + </td> + </tr> + </table> + </div> + </td> + </tr> + </table> +<% end %>
\ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_static_analysis.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_static_analysis.html.erb new file mode 100644 index 00000000000..6ada91d46ae --- /dev/null +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/_static_analysis.html.erb @@ -0,0 +1,63 @@ +<% +if measure('lines') || measure('ncloc') + files=measure('files') + statements=measure('statements') +%> +<table width="100%"> + <tr> + <td valign="top" width="48%" nowrap> + <div class="dashbox"> + <h3>Lines of code</h3> + <% if measure('ncloc') %> + <p><span class="big"> + <%= format_measure('ncloc', :suffix => '', :url => url_for_drilldown('ncloc')) -%> <%= tendency_icon('ncloc', false) -%></span></p> + <% + generated_ncloc=measure('generated_ncloc') + if generated_ncloc && generated_ncloc.value>0 + %> + <p>+<%= format_measure(generated_ncloc, :suffix => ' generated', :url => url_for_drilldown(generated_ncloc)) -%> <%= tendency_icon(generated_ncloc) -%></p> + <% end %> + <p><%= format_measure('lines', :suffix => ' lines', :url => url_for_drilldown('lines')) -%> <%= tendency_icon('lines') -%></p> + <% else%> + <p><span class="big"><%= format_measure('lines', :suffix => '', :url => url_for_drilldown('lines')) -%> <%= tendency_icon('lines', false) -%></span></p> + <% end %> + <% + generated_lines=measure('generated_lines') + if generated_lines && generated_lines.value>0 + %> + <p>incl. <%= format_measure(generated_lines, :suffix => ' generated', :url => url_for_drilldown(generated_lines)) -%> <%= tendency_icon(generated_lines) -%></p> + <% end %> + <% if statements %> + <p> + <%= format_measure(statements, :suffix => ' statements', :url => url_for_drilldown(statements)) -%> <%= tendency_icon(statements) -%> + </p> + <% end %> + <% if files && measure('classes') %> + <p><%= format_measure(files, :suffix => ' files', :url => url_for_drilldown(files)) -%> <%= tendency_icon(files) -%></p> + <% end %> + </div> + </td> + <td width="10"> </td> + <td valign="top"> + <div class="dashbox"> + <% if measure('classes') %> + <h3>Classes</h3> + <p><span class="big"><%= format_measure('classes', :url => url_for_drilldown('classes')) -%> <%= tendency_icon('classes') -%></span></p> + <p><%= format_measure('packages', :suffix => ' packages', :url => url_for_drilldown('packages')) -%> <%= tendency_icon('packages') -%></p> + <% else %> + <h3>Files</h3> + <p><span class="big"><%= format_measure('files', :url => url_for_drilldown('files')) -%> <%= tendency_icon('files') -%></span></p> + <p><%= format_measure('directories', :suffix => ' directories', :url => url_for_drilldown('directories')) -%> <%= tendency_icon('directories') -%></p> + <% end %> + <p><%= format_measure('functions', :suffix => ' methods', :url => url_for_drilldown('functions')) -%> <%= tendency_icon('functions') -%></p> + <% if (measure('accessors')) %> + <p><%= format_measure('accessors', :prefix => '+', :suffix => ' accessors', :url => url_for_drilldown('accessors')) -%> <%= tendency_icon('accessors') -%></p> + <% end %> + <% if measure('paragraphs') %> + <p><%= format_measure('paragraphs', :suffix => ' paragraphs', :url => url_for_drilldown('paragraphs')) -%> <%= tendency_icon('paragraphs') -%></p> + <% end %> + </div> + </td> + </tr> +</table> +<% end %>
\ No newline at end of file |