aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-04-23 00:00:36 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-04-23 19:23:31 +0200
commit5b0b77ac366811d1aa67e15adc10b09eb6351548 (patch)
tree810dd5f06c6c12a1bfbc0787e79b8beaad7d28a4 /plugins
parent4cb7edb0029e605faf960d9d569341c10c4897b2 (diff)
downloadsonarqube-5b0b77ac366811d1aa67e15adc10b09eb6351548.tar.gz
sonarqube-5b0b77ac366811d1aa67e15adc10b09eb6351548.zip
SONAR-6392 Drop measure trends
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java62
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java195
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyDecorator.java129
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb8
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/coverage.html.erb18
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb2
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/debt_overview.erb5
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/documentation_comments_widget.html.erb10
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/duplications_widget.html.erb8
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb14
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb18
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb24
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyAnalyserTest.java128
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyDecoratorTest.java112
14 files changed, 102 insertions, 631 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 fb064dc3486..4afed1eb7ef 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
@@ -20,7 +20,11 @@
package org.sonar.plugins.core;
import com.google.common.collect.ImmutableList;
-import org.sonar.api.*;
+import org.sonar.api.CoreProperties;
+import org.sonar.api.Properties;
+import org.sonar.api.Property;
+import org.sonar.api.PropertyType;
+import org.sonar.api.SonarPlugin;
import org.sonar.core.timemachine.Periods;
import org.sonar.plugins.core.charts.DistributionAreaChart;
import org.sonar.plugins.core.charts.DistributionBarChart;
@@ -34,11 +38,56 @@ import org.sonar.plugins.core.measurefilters.MyFavouritesFilter;
import org.sonar.plugins.core.measurefilters.ProjectFilter;
import org.sonar.plugins.core.notifications.alerts.NewAlerts;
import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
-import org.sonar.plugins.core.sensors.*;
-import org.sonar.plugins.core.timemachine.*;
-import org.sonar.plugins.core.widgets.*;
-import org.sonar.plugins.core.widgets.issues.*;
-import org.sonar.plugins.core.widgets.measures.*;
+import org.sonar.plugins.core.sensors.BranchCoverageDecorator;
+import org.sonar.plugins.core.sensors.CommentDensityDecorator;
+import org.sonar.plugins.core.sensors.CoverageDecorator;
+import org.sonar.plugins.core.sensors.DirectoriesDecorator;
+import org.sonar.plugins.core.sensors.FilesDecorator;
+import org.sonar.plugins.core.sensors.ItBranchCoverageDecorator;
+import org.sonar.plugins.core.sensors.ItCoverageDecorator;
+import org.sonar.plugins.core.sensors.ItLineCoverageDecorator;
+import org.sonar.plugins.core.sensors.LineCoverageDecorator;
+import org.sonar.plugins.core.sensors.ManualMeasureDecorator;
+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.UnitTestDecorator;
+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.TimeMachineConfigurationPersister;
+import org.sonar.plugins.core.timemachine.VariationDecorator;
+import org.sonar.plugins.core.widgets.AlertsWidget;
+import org.sonar.plugins.core.widgets.BubbleChartWidget;
+import org.sonar.plugins.core.widgets.ComplexityWidget;
+import org.sonar.plugins.core.widgets.CoverageWidget;
+import org.sonar.plugins.core.widgets.CustomMeasuresWidget;
+import org.sonar.plugins.core.widgets.DebtOverviewWidget;
+import org.sonar.plugins.core.widgets.DescriptionWidget;
+import org.sonar.plugins.core.widgets.DocumentationCommentsWidget;
+import org.sonar.plugins.core.widgets.DuplicationsWidget;
+import org.sonar.plugins.core.widgets.EventsWidget;
+import org.sonar.plugins.core.widgets.HotspotMetricWidget;
+import org.sonar.plugins.core.widgets.ItCoverageWidget;
+import org.sonar.plugins.core.widgets.ProjectFileCloudWidget;
+import org.sonar.plugins.core.widgets.SizeWidget;
+import org.sonar.plugins.core.widgets.TechnicalDebtPyramidWidget;
+import org.sonar.plugins.core.widgets.TimeMachineWidget;
+import org.sonar.plugins.core.widgets.TimelineWidget;
+import org.sonar.plugins.core.widgets.TreemapWidget;
+import org.sonar.plugins.core.widgets.WelcomeWidget;
+import org.sonar.plugins.core.widgets.issues.ActionPlansWidget;
+import org.sonar.plugins.core.widgets.issues.IssueFilterWidget;
+import org.sonar.plugins.core.widgets.issues.IssueTagCloudWidget;
+import org.sonar.plugins.core.widgets.issues.IssuesWidget;
+import org.sonar.plugins.core.widgets.issues.ProjectIssueFilterWidget;
+import org.sonar.plugins.core.widgets.measures.MeasureFilterAsBubbleChartWidget;
+import org.sonar.plugins.core.widgets.measures.MeasureFilterAsCloudWidget;
+import org.sonar.plugins.core.widgets.measures.MeasureFilterAsHistogramWidget;
+import org.sonar.plugins.core.widgets.measures.MeasureFilterAsPieChartWidget;
+import org.sonar.plugins.core.widgets.measures.MeasureFilterAsTreemapWidget;
+import org.sonar.plugins.core.widgets.measures.MeasureFilterListWidget;
import java.util.List;
@@ -279,7 +328,6 @@ public final class CorePlugin extends SonarPlugin {
ManualMeasureDecorator.class,
// time machine
- TendencyDecorator.class,
VariationDecorator.class,
TimeMachineConfigurationPersister.class,
NewCoverageFileAnalyzer.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java
deleted file mode 100644
index 07fdef297f6..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.timemachine;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import java.util.List;
-
-public class TendencyAnalyser {
-
- public static final Integer TENDENCY_BIG_UP = 2;
- public static final Integer TENDENCY_UP = 1;
- public static final Integer TENDENCY_NEUTRAL = 0;
- public static final Integer TENDENCY_DOWN = -1;
- public static final Integer TENDENCY_BIG_DOWN = -2;
-
- public Integer analyseLevel(List<Double> values) {
- TendencyAnalyser.SlopeData slopeData = analyse(values);
- if (slopeData != null) {
- return slopeData.getLevel();
- }
- return null;
- }
-
- public SlopeData analyse(List<Double> values) {
- double sumY = 0.0;
- double sumX = 0.0;
- double sumYPower2 = 0.0;
- double sumXY = 0.0;
- double sumXPower2 = 0.0;
- int nbrPoints = 0;
- boolean nullValuesYList = true;
- int i = 0;
- for (Double p : values) {
- if (p != null) {
- nullValuesYList = false;
- // SumY calculation
- sumY += p;
- // sumYPower2 calculation
- sumYPower2 += p * p;
- // sumXY calculation
- sumXY += p * (i + 1);
- // SumX calculation
- sumX += (i + 1);
- // sumXPower2 calculation
- sumXPower2 += (i + 1) * (i + 1);
- // Point number calculation
- nbrPoints++;
- }
- i++;
- }
- // no tendency if null values or only 1 value
- if (nullValuesYList || nbrPoints == 1) {
- return null;
- }
- double n0 = (nbrPoints * sumXY) - (sumX * sumY);
- double d = (nbrPoints * sumXPower2) - (sumX * sumX);
- double n1 = (sumY * sumXPower2) - (sumX * sumXY);
-
- SlopeData result = new SlopeData();
-
- // yIntercept Calculation the value when X equals zero
- result.setYIntercept(n1 / d);
- // Slope Calculation
- if (Double.doubleToRawLongBits(n0) == 0L && Double.doubleToRawLongBits(d) == 0L) {
- result.setSlope(0.0);
- } else {
- Double slope = n0 / d;
- if (Double.isNaN(slope) || Double.isInfinite(slope)) {
- result.setSlope(null);
- } else {
- result.setSlope(slope);
- }
- }
- result.setSumXPower2(sumXPower2);
- result.setSumXY(sumXY);
- result.setSumYPower2(sumYPower2);
-
- if (Double.doubleToRawLongBits(sumXPower2) == 0L || Double.doubleToRawLongBits(sumYPower2) == 0L) {
- result.setCorrelationRate(0.0);
- } else {
- result.setCorrelationRate(sumXY / Math.sqrt(sumXPower2 * sumYPower2));
- }
-
- return result;
- }
-
- static class SlopeData {
- private double sumXPower2;
- private double sumYPower2;
- private double sumXY;
- // not used today
- private double yIntercept;
- private Double slope;
- private Double correlationRate;
-
- public double getSumXPower2() {
- return sumXPower2;
- }
-
- public void setSumXPower2(double sumXPower2) {
- this.sumXPower2 = sumXPower2;
- }
-
- public double getSumYPower2() {
- return sumYPower2;
- }
-
- public void setSumYPower2(double sumYPower2) {
- this.sumYPower2 = sumYPower2;
- }
-
- public double getSumXY() {
- return sumXY;
- }
-
- public void setSumXY(double sumXY) {
- this.sumXY = sumXY;
- }
-
- public double getYIntercept() {
- return yIntercept;
- }
-
- public void setYIntercept(double yIntercept) {
- this.yIntercept = yIntercept;
- }
-
- @CheckForNull
- public Double getSlope() {
- return slope;
- }
-
- public void setSlope(@Nullable Double slope) {
- this.slope = slope;
- }
-
- public Double getCorrelationRate() {
- return correlationRate;
- }
-
- public void setCorrelationRate(Double correlationRate) {
- this.correlationRate = correlationRate;
- }
-
- public Integer getLevel() {
- double hSlope = 0.8;
- double nSlope = 0.2;
-
- double vHighCorcoef = 1.0;
- double modCorcoef = 0.69;
- Double correlationCoeff = getCorrelationRate();
- boolean vHCorCoefPos = (correlationCoeff > modCorcoef) && (correlationCoeff <= vHighCorcoef);
- boolean vHCorCoefNeg = (correlationCoeff < -modCorcoef) && (correlationCoeff >= -vHighCorcoef);
-
- if ((vHCorCoefPos || vHCorCoefNeg) && (slope >= hSlope)) {
- return TENDENCY_BIG_UP;
-
- } else if ((vHCorCoefPos || vHCorCoefNeg) && (slope <= -hSlope)) {
- return TENDENCY_BIG_DOWN;
-
- } else if ((vHCorCoefPos || vHCorCoefNeg) && ((slope >= nSlope) && (slope < hSlope))) {
- return TENDENCY_UP;
-
- } else if ((vHCorCoefPos || vHCorCoefNeg) && ((slope <= -nSlope) && (slope > -hSlope))) {
- return TENDENCY_DOWN;
-
- } else if ((vHCorCoefPos || vHCorCoefNeg) && ((slope < nSlope) || (slope > -nSlope))) {
- return TENDENCY_NEUTRAL;
-
- } else if (correlationCoeff == 0 && slope == 0 && !vHCorCoefPos && !vHCorCoefNeg) {
- return TENDENCY_NEUTRAL;
- }
- return null;
- }
- }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyDecorator.java
deleted file mode 100644
index aa98cf6c603..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyDecorator.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.timemachine;
-
-import org.sonar.batch.deprecated.components.PeriodsDefinition;
-
-import org.sonar.api.batch.RequiresDB;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ListMultimap;
-import com.google.common.collect.Lists;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.DateUtils;
-import org.sonar.api.batch.Decorator;
-import org.sonar.api.batch.DecoratorBarriers;
-import org.sonar.api.batch.DecoratorContext;
-import org.sonar.api.batch.DependedUpon;
-import org.sonar.api.batch.DependsUpon;
-import org.sonar.api.batch.TimeMachine;
-import org.sonar.api.batch.TimeMachineQuery;
-import org.sonar.api.measures.Measure;
-import org.sonar.api.measures.Metric;
-import org.sonar.api.measures.MetricFinder;
-import org.sonar.api.resources.Project;
-import org.sonar.api.resources.Resource;
-import org.sonar.api.resources.Scopes;
-
-import java.util.List;
-
-@RequiresDB
-@DependedUpon(DecoratorBarriers.END_OF_TIME_MACHINE)
-public class TendencyDecorator implements Decorator {
-
- public static final String PROP_DAYS_DESCRIPTION = "Number of days the tendency should be calculated on.";
-
- private TimeMachine timeMachine;
- private TimeMachineQuery query;
- private TendencyAnalyser analyser;
- private List<Metric> metrics;
-
- public TendencyDecorator(TimeMachine timeMachine, MetricFinder metricFinder) {
- this.timeMachine = timeMachine;
- this.analyser = new TendencyAnalyser();
- this.metrics = Lists.newLinkedList();
- for (Metric metric : metricFinder.findAll()) {
- if (metric.isNumericType()) {
- metrics.add(metric);
- }
- }
- }
-
- TendencyDecorator(TimeMachine timeMachine, TimeMachineQuery query, TendencyAnalyser analyser) {
- this.timeMachine = timeMachine;
- this.query = query;
- this.analyser = analyser;
- }
-
- @DependsUpon
- public List<Metric> dependsUponMetrics() {
- return metrics;
- }
-
- protected TimeMachineQuery initQuery(Project project) {
- int days = PeriodsDefinition.CORE_TENDENCY_DEPTH_DEFAULT_VALUE;
-
- // resource is set after
- query = new TimeMachineQuery(null)
- .setFrom(DateUtils.addDays(project.getAnalysisDate(), -days))
- .setToCurrentAnalysis(true)
- .setMetrics(metrics);
- return query;
- }
-
- protected TimeMachineQuery resetQuery(Project project, Resource resource) {
- if (query == null) {
- initQuery(project);
- }
- query.setResource(resource);
- return query;
- }
-
- @Override
- public boolean shouldExecuteOnProject(Project project) {
- return true;
- }
-
- @Override
- public void decorate(Resource resource, DecoratorContext context) {
- if (shouldDecorateResource(resource)) {
- resetQuery(context.getProject(), resource);
- List<Object[]> fields = timeMachine.getMeasuresFields(query);
- ListMultimap<Metric, Double> valuesPerMetric = ArrayListMultimap.create();
- for (Object[] field : fields) {
- valuesPerMetric.put((Metric) field[1], (Double) field[2]);
- }
-
- for (Metric metric : query.getMetrics()) {
- Measure measure = context.getMeasure(metric);
- if (measure != null) {
- List<Double> values = valuesPerMetric.get(metric);
- values.add(measure.getValue());
-
- measure.setTendency(analyser.analyseLevel(valuesPerMetric.get(metric)));
- context.saveMeasure(measure);
- }
- }
- }
- }
-
- private boolean shouldDecorateResource(Resource resource) {
- return StringUtils.equals(Scopes.PROJECT, resource.getScope()) || StringUtils.equals(Scopes.DIRECTORY, resource.getScope());
- }
-}
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb
index 6a24a955965..62832d2335a 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb
@@ -15,7 +15,7 @@
<span class="widget-label"><%= message('metric.complexity.name') %></span>
<span class="nowrap">
<%= format_measure(complexity, :url => url_for_drilldown(complexity)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(complexity) : trend_icon(complexity) -%>
+ <%= format_variation(complexity) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
@@ -24,7 +24,7 @@
<span class="widget-label"><%= message('widget.complexity.per_method.suffix') %></span>
<span class="nowrap">
<%= format_measure(function_complexity, :url => url_for_drilldown(function_complexity)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(function_complexity) : trend_icon(function_complexity) -%>
+ <%= format_variation(function_complexity) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
@@ -33,7 +33,7 @@
<span class="widget-label"><%= message('widget.complexity.per_class.suffix') %></span>
<span class="nowrap">
<%= format_measure(class_complexity, :url => url_for_drilldown(class_complexity)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(class_complexity) : trend_icon(class_complexity) -%>
+ <%= format_variation(class_complexity) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
@@ -42,7 +42,7 @@
<span class="widget-label"><%= message('widget.complexity.per_file.suffix') %></span>
<span class="nowrap">
<%= format_measure(file_complexity, :url => url_for_drilldown(file_complexity)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(file_complexity) : trend_icon(file_complexity) -%>
+ <%= format_variation(file_complexity) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/coverage.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/coverage.html.erb
index 29dcc3eef58..e293cfa0d56 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/coverage.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/coverage.html.erb
@@ -13,7 +13,7 @@
<span class="widget-label"><%= message('widget.code_coverage.name') -%></span>
<span class="nowrap">
<%= format_measure(code_coverage_measure, :suffix => '', :url => url_for_drilldown('coverage'), :default => '-') %>
- <%= dashboard_configuration.selected_period? ? format_variation(code_coverage_measure) : trend_icon(code_coverage_measure) -%>
+ <%= format_variation(code_coverage_measure) if dashboard_configuration.selected_period? -%>
</span>
</div>
<%
@@ -24,7 +24,7 @@
<span class="widget-label"><%= message('widget.code_coverage.line_coverage.suffix') -%></span>
<span class="nowrap">
<%= format_measure(line_coverage, :url => url_for_drilldown('uncovered_lines', :highlight => 'line_coverage')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(line_coverage) : trend_icon(line_coverage) -%>
+ <%= format_variation(line_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -36,7 +36,7 @@
<span class="widget-label"><%= message('widget.code_coverage.condition_coverage.suffix') -%></span>
<span class="nowrap">
<%= format_measure(branch_coverage, :url => url_for_drilldown('uncovered_conditions', :highlight => 'branch_coverage')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(branch_coverage) : trend_icon(branch_coverage) -%>
+ <%= format_variation(branch_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -100,7 +100,7 @@
<span class="widget-label"><%= message('widget.code_coverage.test_success') -%></span>
<span class="nowrap">
<%= format_measure(success_percentage, :url => url_for_drilldown(success_percentage)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(success_percentage) : trend_icon(success_percentage) -%>
+ <%= format_variation(success_percentage) if dashboard_configuration.selected_period? -%>
</span>
</div>
@@ -108,7 +108,7 @@
<span class="widget-label"><%= message('widget.code_coverage.failures.suffix') -%></span>
<span class="nowrap">
<%= format_measure(Metric::TEST_FAILURES, :url => url_for_drilldown(Metric::TEST_FAILURES)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(Metric::TEST_FAILURES) : trend_icon(Metric::TEST_FAILURES) -%>
+ <%= format_variation(Metric::TEST_FAILURES) if dashboard_configuration.selected_period? -%>
</span>
</div>
@@ -116,7 +116,7 @@
<span class="widget-label"><%= message('widget.code_coverage.errors.suffix') -%></span>
<span class="nowrap">
<%= format_measure(Metric::TEST_ERRORS, :url => url_for_drilldown(Metric::TEST_ERRORS)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(Metric::TEST_ERRORS) : trend_icon(Metric::TEST_ERRORS) -%>
+ <%= format_variation(Metric::TEST_ERRORS) if dashboard_configuration.selected_period? -%>
</span>
</div>
@@ -124,7 +124,7 @@
<span class="widget-label"><%= message('widget.code_coverage.tests.suffix') -%></span>
<span class="nowrap">
<%= format_measure(tests_measure, :url => url_for_drilldown('tests')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(tests_measure) : trend_icon(tests_measure) -%>
+ <%= format_variation(tests_measure) if dashboard_configuration.selected_period? -%>
</span>
</div>
@@ -135,7 +135,7 @@
<span class="widget-label"><%= message('widget.code_coverage.skipped.suffix') -%></span>
<span class="nowrap">
<%= format_measure(skipped_measure, :url => url_for_drilldown(Metric::SKIPPED_TESTS)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(skipped_measure) : trend_icon(skipped_measure) -%>
+ <%= format_variation(skipped_measure) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -144,7 +144,7 @@
<span class="widget-label"><%= message('widget.code_coverage.execution_time') -%></span>
<span class="nowrap">
<%= format_measure(execution_time, :url => url_for_drilldown('test_execution_time')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(execution_time) : trend_icon(execution_time) -%>
+ <%= format_variation(execution_time) if dashboard_configuration.selected_period? -%>
</span>
</div>
</div>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb
index 3ea96e27bd8..c817403bc8c 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb
@@ -22,7 +22,7 @@
<%= format_measure(measure, :url => url_for_drilldown(measure, :period => period), :period => period) -%>
<% else %>
<%= format_measure(measure, :url => url_for_drilldown(measure)) -%>
- <%= dashboard_configuration.selected_period? ? format_variation(measure) : trend_icon(measure) -%>
+ <%= format_variation(measure) if dashboard_configuration.selected_period? -%>
<% end -%>
</span>
</p>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/debt_overview.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/debt_overview.erb
index a945f084724..87cceb5ff3b 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/debt_overview.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/debt_overview.erb
@@ -11,9 +11,6 @@
<span class="widget-label"><%= message('metric.sqale_rating.name') -%></span>
<span class="nowrap">
<%= format_measure(sqale_rating, :url => url_for_drilldown(sqale_rating)) %>
- <% unless dashboard_configuration.selected_period? %>
- <%= trend_icon(sqale_rating) -%>
- <% end %>
</span>
</div>
</div>
@@ -26,7 +23,7 @@
<span class="widget-label"><%= message('metric.sqale_debt_ratio.name') -%></span>
<span class="nowrap">
<%= format_measure(sqale_debt_ratio, :url => url_for_drilldown(sqale_debt_ratio)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(sqale_debt_ratio) : trend_icon(sqale_debt_ratio) -%>
+ <%= format_variation(sqale_debt_ratio) if dashboard_configuration.selected_period? -%>
</span>
</div>
</div>
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
index e0c4ffe5e56..06423d5c029 100644
--- 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
@@ -17,7 +17,7 @@
<span class="widget-label"><%= message('widget.documentation_comments.documentation') -%></span>
<span class="nowrap">
<%= format_measure(public_documented_api_density, :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_DOCUMENTED_API_DENSITY)) %>
- <%= dashboard_configuration.selected_period? ? format_variation('public_documented_api_density') : trend_icon('public_documented_api_density') -%>
+ <%= format_variation('public_documented_api_density') if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -25,14 +25,14 @@
<span class="widget-label"><%= message('metric.public_api.name') -%></span>
<span class="nowrap">
<%= format_measure(public_api,:url => url_for_drilldown(public_api)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(public_api) : trend_icon(public_api) -%>
+ <%= format_variation(public_api) if dashboard_configuration.selected_period? -%>
</span>
</div>
<div class="widget-measure">
<span class="widget-label"><%= message('metric.public_undocumented_api.abbreviation') -%></span>
<span class="nowrap">
<%= format_measure(public_undocumented_api,:url => url_for_drilldown(public_undocumented_api)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(public_undocumented_api) : trend_icon(public_undocumented_api) -%>
+ <%= format_variation(public_undocumented_api) if dashboard_configuration.selected_period? -%>
</span>
</div>
</div>
@@ -45,14 +45,14 @@
<span class="widget-label"><%= message('widget.documentation_comments.comments') -%></span>
<span class="nowrap">
<%= format_measure(comment_lines_density,:url => url_for_drilldown(comment_lines_density))%>
- <%= dashboard_configuration.selected_period? ? format_variation(comment_lines_density) : trend_icon(comment_lines_density) -%>
+ <%= format_variation(comment_lines_density) if dashboard_configuration.selected_period? -%>
</span>
</div>
<div class="widget-measure">
<span class="widget-label"><%= message('metric.comment_lines.name') -%></span>
<span class="nowrap">
<%= format_measure(comment_lines,:url => url_for_drilldown(comment_lines)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(comment_lines) : trend_icon(comment_lines) -%>
+ <%= format_variation(comment_lines) if dashboard_configuration.selected_period? -%>
</span>
</div>
</div>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/duplications_widget.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/duplications_widget.html.erb
index 3eaaf6d4a55..99b487a57a7 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/duplications_widget.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/duplications_widget.html.erb
@@ -8,7 +8,7 @@
<span class="widget-label"><%= message('widget.duplications.duplications') -%></span>
<span class="nowrap">
<%= format_measure(duplicated_lines_density, :url => url_for_drilldown('duplicated_lines', :highlight => 'duplicated_lines_density')) %>
- <%= dashboard_configuration.selected_period? ? format_variation('duplicated_lines_density') : trend_icon('duplicated_lines_density') -%>
+ <%= format_variation('duplicated_lines_density') if dashboard_configuration.selected_period? -%>
</span>
</div>
@@ -16,7 +16,7 @@
<span class="widget-label"><%= message('widget.duplications.lines.suffix') -%></span>
<span class="nowrap">
<%= format_measure(measure('duplicated_lines'), :url => url_for_drilldown('duplicated_lines'))%>
- <%= dashboard_configuration.selected_period? ? format_variation('duplicated_lines') : trend_icon('duplicated_lines') -%>
+ <%= format_variation('duplicated_lines') if dashboard_configuration.selected_period? -%>
</span>
</div>
@@ -24,7 +24,7 @@
<span class="widget-label"><%= message('widget.duplications.blocks.suffix') -%></span>
<span class="nowrap">
<%= format_measure(measure('duplicated_blocks'), :url => url_for_drilldown('duplicated_blocks'))%>
- <%= dashboard_configuration.selected_period? ? format_variation('duplicated_blocks') : trend_icon('duplicated_blocks') -%>
+ <%= format_variation('duplicated_blocks') if dashboard_configuration.selected_period? -%>
</span>
</div>
@@ -32,7 +32,7 @@
<span class="widget-label"><%= message('widget.duplications.files.suffix') -%></span>
<span class="nowrap">
<%= format_measure(measure('duplicated_files'), :url => url_for_drilldown('duplicated_files'))%>
- <%= dashboard_configuration.selected_period? ? format_variation('duplicated_files') : trend_icon('duplicated_files') -%>
+ <%= format_variation('duplicated_files') if dashboard_configuration.selected_period? -%>
</span>
</div>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb
index 0e645dfa2bd..d27c35ca448 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/issues.html.erb
@@ -34,7 +34,7 @@
title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">
<%= format_measure(technical_debt) -%>
</a>
- <%= dashboard_configuration.selected_period? ? format_variation(technical_debt) : trend_icon(technical_debt) -%>
+ <%= format_variation(technical_debt) if dashboard_configuration.selected_period? -%>
</div>
<div class="widget-measure-delta">
<%
@@ -74,7 +74,7 @@
<%= format_measure(issues) -%>
</a>
</span>
- <%= dashboard_configuration.selected_period? ? format_variation(issues) : trend_icon(issues) -%>
+ <%= format_variation(issues) if dashboard_configuration.selected_period? -%>
</span>
</div>
<div class="widget-measure-delta">
@@ -121,8 +121,6 @@
<a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=BLOCKER|createdAfter=<%= period_date -%>"
class="varw widget-link widget-link-red link-<%= widget.key %>-new-blocker-issues"
title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_blocker_issues, :style => 'none', :default => '-') -%></a>
- <% else %>
- <%= trend_icon(blocker_issues, :empty => true) -%>
<% end %>
</td>
</tr>
@@ -142,8 +140,6 @@
<a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=CRITICAL|createdAfter=<%= period_date -%>"
class="varw widget-link widget-link-red link-<%= widget.key %>-new-critical-issues"
title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_critical_issues, :style => 'none', :default => '-') -%></a>
- <% else %>
- <%= trend_icon(critical_issues, :empty => true) -%>
<% end %>
</td>
</tr>
@@ -163,8 +159,6 @@
<a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MAJOR|createdAfter=<%= period_date -%>"
class="varw widget-link widget-link-red link-<%= widget.key %>-new-major-issues"
title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_major_issues, :style => 'none', :default => '-') -%></a>
- <% else %>
- <%= trend_icon(major_issues, :empty => true) -%>
<% end %>
</td>
</tr>
@@ -184,8 +178,6 @@
<a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=MINOR|createdAfter=<%= period_date -%>"
class="varw widget-link widget-link-red link-<%= widget.key %>-new-minor-issues"
title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_minor_issues, :style => 'none', :default => '-') -%></a>
- <% else %>
- <%= trend_icon(minor_issues, :empty => true) -%>
<% end %>
</td>
</tr>
@@ -205,8 +197,6 @@
<a href="<%= url_for(:controller => 'component_issues', :action => 'index') -%>?id=<%= url_encode(@project.key) -%>#resolved=false|severities=INFO|createdAfter=<%= period_date -%>"
class="varw widget-link widget-link-red link-<%= widget.key %>-new-info-issues"
title="<%= tooltip -%>" data-toggle="tooltip" data-placement="bottom">+<%= format_variation(new_info_issues, :style => 'none', :default => '-') -%></a>
- <% else %>
- <%= trend_icon(info_issues, :empty => true) -%>
<% end %>
</td>
</tr>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb
index 0f0daaafdd2..52c01fe6728 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb
@@ -14,7 +14,7 @@
<span class="widget-label"><%= message('widget.it-coverage.name') -%></span>
<span class="nowrap">
<%= format_measure(it_coverage, :url => url_for_drilldown('it_coverage'), :default => '-') %>
- <%= dashboard_configuration.selected_period? ? format_variation(it_coverage) : trend_icon(it_coverage) -%>
+ <%= format_variation(it_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
@@ -26,7 +26,7 @@
<span class="widget-label"><%= message('widget.it-coverage.line_coverage.suffix') -%></span>
<span class="nowrap">
<%= format_measure(it_line_coverage, :url => url_for_drilldown('it_uncovered_lines', :highlight => 'it_line_coverage')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(it_line_coverage) : trend_icon(it_line_coverage) -%>
+ <%= format_variation(it_line_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -39,7 +39,7 @@
<span class="widget-label"><%= message('widget.it-coverage.condition_coverage.suffix') -%></span>
<span class="nowrap">
<%= format_measure(it_branch_coverage, :url => url_for_drilldown('it_uncovered_conditions', :highlight => 'it_branch_coverage')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(it_branch_coverage) : trend_icon(it_branch_coverage) -%>
+ <%= format_variation(it_branch_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -114,7 +114,7 @@
<span class="widget-label"><%= message('widget.overall-coverage.name') -%></span>
<span class="nowrap">
<%= format_measure(overall_coverage, :url => url_for_drilldown('overall_coverage'), :default => '-') %>
- <%= dashboard_configuration.selected_period? ? format_variation(overall_coverage) : trend_icon(overall_coverage) -%>
+ <%= format_variation(overall_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
@@ -126,7 +126,7 @@
<span class="widget-label"><%= message('widget.overall-coverage.line_coverage.suffix') -%></span>
<span class="nowrap">
<%= format_measure(overall_line_coverage, :url => url_for_drilldown('overall_uncovered_lines', :highlight => 'overall_line_coverage')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(overall_line_coverage) : trend_icon(overall_line_coverage) -%>
+ <%= format_variation(overall_line_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -139,7 +139,7 @@
<span class="widget-label"><%= message('widget.overall-coverage.condition_coverage.suffix') -%></span>
<span class="nowrap">
<%= format_measure(overall_branch_coverage, :url => url_for_drilldown('overall_uncovered_conditions', :highlight => 'overall_branch_coverage')) %>
- <%= dashboard_configuration.selected_period? ? format_variation(overall_branch_coverage) : trend_icon(overall_branch_coverage) -%>
+ <%= format_variation(overall_branch_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -170,7 +170,7 @@
:period => dashboard_configuration.period_index,
:url => url_for_drilldown(new_coverage, :period => dashboard_configuration.period_index),
:default => '-') %>
- <%= dashboard_configuration.selected_period? ? format_variation(new_coverage) : trend_icon(new_coverage) -%>
+ <%= format_variation(new_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -182,7 +182,7 @@
<%= format_measure(new_line_coverage,
:period => dashboard_configuration.period_index,
:url => url_for_drilldown(new_line_coverage, :period => dashboard_configuration.period_index)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(new_line_coverage) : trend_icon(new_line_coverage) -%>
+ <%= format_variation(new_line_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
@@ -194,7 +194,7 @@
<%= format_measure(new_branch_coverage,
:period => dashboard_configuration.period_index,
:url => url_for_drilldown(new_branch_coverage, :period => dashboard_configuration.period_index)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(new_branch_coverage) : trend_icon(new_branch_coverage) -%>
+ <%= format_variation(new_branch_coverage) if dashboard_configuration.selected_period? -%>
</span>
</div>
<% end %>
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb
index 7811e848f0d..1a4387b1ecc 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb
@@ -26,13 +26,13 @@
<span class="widget-label"><%= message('metric.ncloc.name') -%></span>
<span class="nowrap">
<%= format_measure(ncloc, :url => url_for_drilldown(ncloc)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(ncloc) : trend_icon(ncloc) -%>
+ <%= format_variation(ncloc) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% if generated_ncloc && generated_ncloc.value>0 %>
<p class="widget-label nowrap" style="margin-bottom: 7px">
<%= message('including_abbreviated') -%>
- <%= format_measure(generated_ncloc, :url => url_for_drilldown(generated_ncloc)) -%> <%= dashboard_configuration.selected_period? ? format_variation(generated_ncloc) : trend_icon(generated_ncloc) -%>
+ <%= format_measure(generated_ncloc, :url => url_for_drilldown(generated_ncloc)) -%> <%= format_variation(generated_ncloc) if dashboard_configuration.selected_period? -%>
<%= message('metric.generated_ncloc.name.suffix') -%>
</p>
<% end %>
@@ -92,7 +92,7 @@
<span class="widget-label"><%= message('metric.lines.name') -%></span>
<span class="nowrap">
<%= format_measure(lines, :url => url_for_drilldown(ncloc)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(lines) : trend_icon(lines) -%>
+ <%= format_variation(lines) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
@@ -105,7 +105,7 @@
<span class="widget-label"><%= message('metric.files.name') -%></span>
<span class="nowrap">
<%= format_measure(files, :url => url_for_drilldown(files)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(files) : trend_icon(files) -%>
+ <%= format_variation(files) if dashboard_configuration.selected_period? -%>
</span>
</p>
@@ -114,7 +114,7 @@
<span class="widget-label"><%= message('metric.directories.name') -%></span>
<span class="nowrap">
<%= format_measure(directories, :url => url_for_drilldown(directories)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(directories) : trend_icon(directories) -%>
+ <%= format_variation(directories) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
@@ -123,14 +123,14 @@
<span class="widget-label"><%= message('metric.lines.name') -%></span>
<span class="nowrap">
<%= format_measure(lines, :url => url_for_drilldown(lines)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(lines) : trend_icon(lines) -%>
+ <%= format_variation(lines) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% if generated_lines && generated_lines.value>0 %>
<p class="widget-label nowrap" style="margin-bottom: 7px">
<%= message('including_abbreviated') -%>
- <%= format_measure(generated_lines, :url => url_for_drilldown(generated_lines)) -%> <%= dashboard_configuration.selected_period? ? format_variation(generated_lines) : trend_icon(generated_lines) -%>
+ <%= format_measure(generated_lines, :url => url_for_drilldown(generated_lines)) -%> <%= format_variation(generated_lines) if dashboard_configuration.selected_period? -%>
<%= message('metric.generated_lines.name.suffix') -%>
</p>
<% end %>
@@ -140,7 +140,7 @@
<span class="widget-label"><%= message('projects') -%></span>
<span class="nowrap">
<span class="widget-number"><%= format_measure(projects) %></span>
- <%= dashboard_configuration.selected_period? ? format_variation(projects) : trend_icon(projects) -%>
+ <%= format_variation(projects) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
@@ -154,7 +154,7 @@
<span class="widget-label"><%= message('metric.functions.name') -%></span>
<span class="nowrap">
<%= format_measure(functions, :url => url_for_drilldown(functions)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(functions) : trend_icon(functions) -%>
+ <%= format_variation(functions) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
@@ -164,7 +164,7 @@
<span class="widget-label"><%= message('metric.classes.name') -%></span>
<span class="nowrap">
<%= format_measure(classes, :url => url_for_drilldown(classes)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(classes) : trend_icon(classes) -%>
+ <%= format_variation(classes) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
@@ -174,7 +174,7 @@
<span class="widget-label"><%= message('metric.statements.name') -%></span>
<span class="nowrap">
<%= format_measure(statements, :url => url_for_drilldown(statements)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(statements) : trend_icon(statements) -%>
+ <%= format_variation(statements) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
@@ -184,7 +184,7 @@
<span class="widget-label"><%= message('metric.accessors.name') -%></span>
<span class="nowrap">
<%= format_measure(accessors, :url => url_for_drilldown(accessors)) %>
- <%= dashboard_configuration.selected_period? ? format_variation(accessors) : trend_icon(accessors) -%>
+ <%= format_variation(accessors) if dashboard_configuration.selected_period? -%>
</span>
</p>
<% end %>
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyAnalyserTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyAnalyserTest.java
deleted file mode 100644
index ae1e8630786..00000000000
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyAnalyserTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.timemachine;
-
-import org.junit.Test;
-
-import java.util.Arrays;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class TendencyAnalyserTest {
- static TendencyAnalyser.SlopeData analyse(Double... values) {
- return new TendencyAnalyser().analyse(Arrays.asList(values));
- }
-
- static Integer analyseLevel(Double... values) {
- return new TendencyAnalyser().analyseLevel(Arrays.asList(values));
- }
-
- @Test
- public void testNoData() {
- TendencyAnalyser.SlopeData slopeData = analyse();
-
- assertThat(slopeData).isNull();
- }
-
- @Test
- public void testNotEnoughData() {
- assertThat(analyseLevel(10.0)).isNull();
- }
-
- @Test
- public void testTendencyOnThreeDays() {
- TendencyAnalyser.SlopeData slopeData = analyse(10.0, null, 9.9);
-
- assertThat(slopeData.getSlope()).isGreaterThan(-0.5).isLessThan(0.5);
- assertThat(slopeData.getLevel()).isEqualTo(TendencyAnalyser.TENDENCY_NEUTRAL);
- }
-
- @Test
- public void testTendencyOnTwoZeroDays() {
- TendencyAnalyser.SlopeData slopeData = analyse(0.0, 0.0);
-
- assertThat(slopeData.getSlope()).isZero();
- assertThat(slopeData.getLevel()).isEqualTo(TendencyAnalyser.TENDENCY_NEUTRAL);
- }
-
- @Test
- public void testTendencyOnThreeZeroDays() {
- TendencyAnalyser.SlopeData slopeData = analyse(0.0, 0.0, 0.0);
-
- assertThat(slopeData.getSlope()).isZero();
- assertThat(slopeData.getLevel()).isEqualTo(TendencyAnalyser.TENDENCY_NEUTRAL);
- }
-
- @Test
- public void testBigDownOnThreeDays() {
- TendencyAnalyser.SlopeData slopeData = analyse(90.0, 91.0, 50.0);
-
- assertThat(slopeData.getSlope()).isLessThan(-2.0);
- assertThat(slopeData.getLevel()).isEqualTo(TendencyAnalyser.TENDENCY_BIG_DOWN);
- }
-
- @Test
- public void testFlatTendency() {
- TendencyAnalyser.SlopeData slopeData = analyse(10.0, 10.2, 9.9);
-
- assertThat(slopeData.getSlope()).isGreaterThan(-0.5).isLessThan(0.5);
- assertThat(slopeData.getLevel()).isEqualTo(TendencyAnalyser.TENDENCY_NEUTRAL);
- }
-
- @Test
- public void testFlatTendencyWithPeak() {
- TendencyAnalyser.SlopeData slopeData = analyse(10.0, 15.0, 10.0);
-
- assertThat(slopeData.getSlope()).isGreaterThan(-0.5).isLessThan(0.5);
- assertThat(slopeData.getLevel()).isEqualTo(TendencyAnalyser.TENDENCY_NEUTRAL);
- }
-
- @Test
- public void testBigUpTendencyOnThreeValues() {
- TendencyAnalyser.SlopeData slopeData = analyse(10.0, 12.0, 15.5);
-
- assertThat(slopeData.getSlope()).isGreaterThan(2.5).isLessThan(3.0);
- assertThat(slopeData.getLevel()).isEqualTo(TendencyAnalyser.TENDENCY_BIG_UP);
- }
-
- @Test
- public void testBigUpTendencyOnTenValues() {
- TendencyAnalyser.SlopeData slopeData = analyse(45.0, 60.0, 57.0, 65.0, 58.0, 68.0, 59.0, 66.0, 76.0, 80.0);
-
- assertThat(slopeData.getSlope()).isGreaterThan(2.5).isLessThan(3.0);
- assertThat(slopeData.getLevel()).isEqualTo(TendencyAnalyser.TENDENCY_BIG_UP);
- }
-
- @Test
- public void testMediumUpTendency() {
- TendencyAnalyser.SlopeData slopeData = analyse(5.0, 4.5, 5.1, 5.5, 5.3, 6.4, 6.3, 6.6, 6.8, 6.5);
-
- assertThat(slopeData.getSlope()).isGreaterThan(0.0).isLessThan(1.0);
- assertThat(slopeData.getLevel()).isEqualTo(TendencyAnalyser.TENDENCY_UP);
- }
-
- @Test
- public void testAsymetricAlgorithm() {
- TendencyAnalyser.SlopeData slopeData1 = analyse(45.0, 47.0, 95.0);
- TendencyAnalyser.SlopeData slopeData2 = analyse(95.0, 45.0, 47.0);
-
- assertThat(slopeData1.getSlope()).isNotEqualTo(slopeData2.getSlope());
- }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyDecoratorTest.java
deleted file mode 100644
index 839e6f51862..00000000000
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyDecoratorTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.timemachine;
-
-import org.junit.Test;
-import org.junit.matchers.JUnitMatchers;
-import org.sonar.api.batch.DecoratorContext;
-import org.sonar.api.batch.TimeMachine;
-import org.sonar.api.batch.TimeMachineQuery;
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.measures.Measure;
-import org.sonar.api.measures.Metric;
-import org.sonar.api.measures.MetricFinder;
-import org.sonar.api.resources.Directory;
-import org.sonar.api.resources.Project;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.mockito.Matchers.anyList;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class TendencyDecoratorTest {
-
- @Test
- public void initQuery() throws ParseException {
- Project project = mock(Project.class);
- when(project.getAnalysisDate()).thenReturn(date("2009-12-25"));
-
- MetricFinder metricFinder = mock(MetricFinder.class);
- when(metricFinder.findAll()).thenReturn(Arrays.<Metric>asList(CoreMetrics.LINES, CoreMetrics.COVERAGE, CoreMetrics.COVERAGE_LINE_HITS_DATA));
-
- TendencyDecorator decorator = new TendencyDecorator(null, metricFinder);
-
- TimeMachineQuery query = decorator.initQuery(project);
- assertThat(query.getMetrics().size(), is(2));
- assertThat(query.getMetrics(), JUnitMatchers.<Metric>hasItems(CoreMetrics.LINES, CoreMetrics.COVERAGE));
- assertThat(query.getFrom(), is(date("2009-11-25")));
- assertThat(query.isToCurrentAnalysis(), is(true));
- }
-
- @Test
- public void includeCurrentMeasures() throws ParseException {
- TendencyAnalyser analyser = mock(TendencyAnalyser.class);
- TimeMachineQuery query = new TimeMachineQuery(null).setMetrics(CoreMetrics.LINES, CoreMetrics.COVERAGE);
- TimeMachine timeMachine = mock(TimeMachine.class);
-
- when(timeMachine.getMeasuresFields(query)).thenReturn(Arrays.<Object[]>asList(
- new Object[] {date("2009-12-01"), CoreMetrics.LINES, 1200.0},
- new Object[] {date("2009-12-01"), CoreMetrics.COVERAGE, 80.5},
- new Object[] {date("2009-12-02"), CoreMetrics.LINES, 1300.0},
- new Object[] {date("2009-12-02"), CoreMetrics.COVERAGE, 79.6},
- new Object[] {date("2009-12-15"), CoreMetrics.LINES, 1150.0}
- ));
-
- DecoratorContext context = mock(DecoratorContext.class);
- when(context.getMeasure(CoreMetrics.LINES)).thenReturn(new Measure(CoreMetrics.LINES, 1400.0));
- when(context.getMeasure(CoreMetrics.COVERAGE)).thenReturn(new Measure(CoreMetrics.LINES, 90.0));
-
- TendencyDecorator decorator = new TendencyDecorator(timeMachine, query, analyser);
- decorator.decorate(Directory.create("org/foo"), context);
-
- verify(analyser).analyseLevel(Arrays.asList(1200.0, 1300.0, 1150.0, 1400.0));
- verify(analyser).analyseLevel(Arrays.asList(80.5, 79.6, 90.0));
- }
-
- @Test
- public void noTendencyIfNoCurrentMeasures() throws ParseException {
- TendencyAnalyser analyser = mock(TendencyAnalyser.class);
- TimeMachineQuery query = new TimeMachineQuery(null).setMetrics(CoreMetrics.LINES, CoreMetrics.COVERAGE);
- TimeMachine timeMachine = mock(TimeMachine.class);
-
- when(timeMachine.getMeasuresFields(query)).thenReturn(Arrays.<Object[]>asList(
- new Object[] {date("2009-12-01"), CoreMetrics.LINES, 1200.0},
- new Object[] {date("2009-12-02"), CoreMetrics.LINES, 1300.0}
- ));
-
- DecoratorContext context = mock(DecoratorContext.class);
- TendencyDecorator decorator = new TendencyDecorator(timeMachine, query, analyser);
- decorator.decorate(Directory.create("org/foo"), context);
-
- verify(analyser, never()).analyseLevel(anyList());
- }
-
- private Date date(String date) throws ParseException {
- return new SimpleDateFormat("yyyy-MM-dd").parse(date);
- }
-}