import org.sonar.plugins.core.filters.TreeMapFilter;
import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
import org.sonar.plugins.core.security.DefaultResourcePermissions;
-import org.sonar.plugins.core.sensors.OverallBranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.OverallCoverageDecorator;
-import org.sonar.plugins.core.sensors.OverallLineCoverageDecorator;
import org.sonar.plugins.core.sensors.BranchCoverageDecorator;
import org.sonar.plugins.core.sensors.CheckAlertThresholds;
import org.sonar.plugins.core.sensors.CommentDensityDecorator;
import org.sonar.plugins.core.sensors.LineCoverageDecorator;
import org.sonar.plugins.core.sensors.ManualMeasureDecorator;
import org.sonar.plugins.core.sensors.ManualViolationInjector;
+import org.sonar.plugins.core.sensors.OverallBranchCoverageDecorator;
+import org.sonar.plugins.core.sensors.OverallCoverageDecorator;
+import org.sonar.plugins.core.sensors.OverallLineCoverageDecorator;
import org.sonar.plugins.core.sensors.ProfileEventsSensor;
import org.sonar.plugins.core.sensors.ProfileSensor;
import org.sonar.plugins.core.sensors.ProjectLinksSensor;
import org.sonar.plugins.core.timemachine.NewCoverageAggregator;
import org.sonar.plugins.core.timemachine.NewCoverageFileAnalyzer;
import org.sonar.plugins.core.timemachine.NewItCoverageFileAnalyzer;
+import org.sonar.plugins.core.timemachine.NewOverallCoverageFileAnalyzer;
import org.sonar.plugins.core.timemachine.NewViolationsDecorator;
import org.sonar.plugins.core.timemachine.ReferenceAnalysis;
import org.sonar.plugins.core.timemachine.TendencyDecorator;
TimeMachineConfigurationPersister.class,
NewCoverageFileAnalyzer.class,
NewItCoverageFileAnalyzer.class,
+ NewOverallCoverageFileAnalyzer.class,
NewCoverageAggregator.class);
}
}
public List<Metric> generatesNewCoverageMetrics() {
return Arrays.asList(
CoreMetrics.NEW_LINES_TO_COVER, CoreMetrics.NEW_UNCOVERED_LINES, CoreMetrics.NEW_CONDITIONS_TO_COVER, CoreMetrics.NEW_UNCOVERED_CONDITIONS,
- CoreMetrics.NEW_IT_LINES_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_LINES, CoreMetrics.NEW_IT_CONDITIONS_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_CONDITIONS);
+ CoreMetrics.NEW_IT_LINES_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_LINES, CoreMetrics.NEW_IT_CONDITIONS_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_CONDITIONS,
+ CoreMetrics.NEW_OVERALL_LINES_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_LINES, CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS);
}
public void decorate(Resource resource, DecoratorContext context) {
aggregate(context, CoreMetrics.NEW_IT_UNCOVERED_LINES, maxPeriods);
aggregate(context, CoreMetrics.NEW_IT_CONDITIONS_TO_COVER, maxPeriods);
aggregate(context, CoreMetrics.NEW_IT_UNCOVERED_CONDITIONS, maxPeriods);
+ aggregate(context, CoreMetrics.NEW_OVERALL_LINES_TO_COVER, maxPeriods);
+ aggregate(context, CoreMetrics.NEW_OVERALL_UNCOVERED_LINES, maxPeriods);
+ aggregate(context, CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER, maxPeriods);
+ aggregate(context, CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS, maxPeriods);
}
}
--- /dev/null
+/*
+ * 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.core.timemachine;
+
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.measures.Metric;
+import org.sonar.batch.components.TimeMachineConfiguration;
+
+public class NewOverallCoverageFileAnalyzer extends AbstractNewCoverageFileAnalyzer {
+
+ public NewOverallCoverageFileAnalyzer(TimeMachineConfiguration timeMachineConfiguration) {
+ super(timeMachineConfiguration);
+ }
+
+ @Override
+ public Metric getCoverageLineHitsDataMetric() {
+ return CoreMetrics.OVERALL_COVERAGE_LINE_HITS_DATA;
+ }
+
+ @Override
+ public Metric getConditionsByLineMetric() {
+ return CoreMetrics.OVERALL_CONDITIONS_BY_LINE;
+ }
+
+ @Override
+ public Metric getCoveredConditionsByLineMetric() {
+ return CoreMetrics.OVERALL_COVERED_CONDITIONS_BY_LINE;
+ }
+
+ @Override
+ public Metric getNewLinesToCoverMetric() {
+ return CoreMetrics.NEW_OVERALL_LINES_TO_COVER;
+ }
+
+ @Override
+ public Metric getNewUncoveredLinesMetric() {
+ return CoreMetrics.NEW_OVERALL_UNCOVERED_LINES;
+ }
+
+ @Override
+ public Metric getNewConditionsToCoverMetric() {
+ return CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER;
+ }
+
+ @Override
+ public Metric getNewUncoveredConditionsMetric() {
+ return CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS;
+ }
+}
<% end %>
</div>
</td>
+ <% end -%>
+ <% if overall_coverage -%>
+ <td nowrap valign="top">
+ <div class="dashbox">
+ <p class="title"><%= message('widget.overall-coverage.name') -%></p>
+
+ <p>
+ <span class="big"><%= format_measure(overall_coverage, :suffix => '', :url => url_for_drilldown('overall_coverage'), :default => '-') %></span>
+ <%= dashboard_configuration.selected_period? ? format_variation(overall_coverage) : trend_icon(overall_coverage) -%>
+ </p>
+ <% it_line_coverage=measure('overall_line_coverage')
+ if it_line_coverage %>
+ <p>
+ <%= format_measure(it_line_coverage, :suffix => message('widget.overall-coverage.line_coverage.suffix'), :url => url_for_drilldown('overall_uncovered_lines', :highlight => 'overall_line_coverage')) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(it_line_coverage) : trend_icon(it_line_coverage) -%>
+ </p>
+ <% end %>
+ <% it_branch_coverage=measure('overall_branch_coverage')
+ if it_branch_coverage %>
+ <p>
+ <%= format_measure(it_branch_coverage, :suffix => message('widget.overall-coverage.branch_coverage.suffix'), :url => url_for_drilldown('overall_uncovered_conditions', :highlight => 'overall_branch_coverage')) %>
+ <%= dashboard_configuration.selected_period? ? format_variation(it_branch_coverage) : trend_icon(it_branch_coverage) -%>
+ </p>
+ <% end %>
+ </div>
+ </td>
+ <% end -%>
+ </tr>
+ <tr>
+ <% if it_coverage -%>
<td nowrap valign="top">
<div class="dashbox">
<%
</td>
<% end -%>
<% if overall_coverage -%>
- <td nowrap valign="top">
- <div class="dashbox">
- <p class="title"><%= message('widget.overall-coverage.name') -%></p>
-
- <p>
- <span class="big"><%= format_measure(overall_coverage, :suffix => '', :url => url_for_drilldown('overall_coverage'), :default => '-') %></span>
- <%= dashboard_configuration.selected_period? ? format_variation(overall_coverage) : trend_icon(overall_coverage) -%>
- </p>
- <% it_line_coverage=measure('overall_line_coverage')
- if it_line_coverage %>
- <p>
- <%= format_measure(it_line_coverage, :suffix => message('widget.overall-coverage.line_coverage.suffix'), :url => url_for_drilldown('overall_uncovered_lines', :highlight => 'overall_line_coverage')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(it_line_coverage) : trend_icon(it_line_coverage) -%>
- </p>
- <% end %>
- <% it_branch_coverage=measure('overall_branch_coverage')
- if it_branch_coverage %>
- <p>
- <%= format_measure(it_branch_coverage, :suffix => message('widget.overall-coverage.branch_coverage.suffix'), :url => url_for_drilldown('overall_uncovered_conditions', :highlight => 'overall_branch_coverage')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(it_branch_coverage) : trend_icon(it_branch_coverage) -%>
- </p>
- <% end %>
- </div>
- </td>
<td nowrap valign="top">
<div class="dashbox">
<%
<div id="coverage_header" class="tab_header">
- <% if @period && (measure('new_coverage') || measure('new_it_coverage')|| measure('new_overall_coverage')) %>
+ <% if @period && (measure('new_coverage') || measure('new_it_coverage') || measure('new_overall_coverage')) %>
<p><%= message('coverage_viewer.on_new_code') -%> :</p>
<table>
<tr>