aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java34
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItBranchCoverageDecorator.java11
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageDecorator.java17
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItLineCoverageDecorator.java11
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItMetrics.java130
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensor.java14
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewerDefinition.java39
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/CoveragePanel.java150
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/CoverageViewer.java69
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/Metrics.java42
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewer.gwt.xml9
-rw-r--r--plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewerDev.gwt.xml6
-rw-r--r--plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoPluginTest.java26
-rw-r--r--plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItMetricsTest.java34
-rw-r--r--plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensorTest.java36
-rw-r--r--plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties46
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java1323
-rw-r--r--sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java22
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb55
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb20
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb37
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb18
-rw-r--r--sonar-server/src/main/webapp/stylesheets/style.css2
23 files changed, 912 insertions, 1239 deletions
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java
index 811efa13f8a..18be4847537 100644
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java
+++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java
@@ -19,14 +19,13 @@
*/
package org.sonar.plugins.jacoco;
-import java.util.Arrays;
-import java.util.List;
-
-import org.sonar.api.Plugin;
import org.sonar.api.Properties;
import org.sonar.api.Property;
+import org.sonar.api.SonarPlugin;
import org.sonar.plugins.jacoco.itcoverage.*;
-import org.sonar.plugins.jacoco.itcoverage.viewer.CoverageViewerDefinition;
+
+import java.util.Arrays;
+import java.util.List;
@Properties({
@Property(
@@ -87,20 +86,7 @@ import org.sonar.plugins.jacoco.itcoverage.viewer.CoverageViewerDefinition;
module = true,
project = true
) })
-public class JaCoCoPlugin implements Plugin {
-
- public String getKey() {
- return "jacoco";
- }
-
- public String getName() {
- return "JaCoCo";
- }
-
- public String getDescription() {
- return "<a href='http://www.eclemma.org/jacoco/'>JaCoCo</a> calculates coverage of unit tests." +
- " Set the parameter 'Code coverage plugin' to <code>jacoco</code> in the General plugin.";
- }
+public class JaCoCoPlugin extends SonarPlugin {
public List getExtensions() {
return Arrays.asList(
@@ -115,18 +101,10 @@ public class JaCoCoPlugin implements Plugin {
JaCoCoSensor.class,
// Integration tests
- JaCoCoItMetrics.class,
JaCoCoItSensor.class,
ItCoverageWidget.class,
ItCoverageDecorator.class,
ItLineCoverageDecorator.class,
- ItBranchCoverageDecorator.class,
- CoverageViewerDefinition.class);
+ ItBranchCoverageDecorator.class);
}
-
- @Override
- public String toString() {
- return getKey();
- }
-
}
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItBranchCoverageDecorator.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItBranchCoverageDecorator.java
index d3a4147806a..6c7da52a085 100644
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItBranchCoverageDecorator.java
+++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItBranchCoverageDecorator.java
@@ -21,6 +21,7 @@ package org.sonar.plugins.jacoco.itcoverage;
import org.sonar.api.batch.DecoratorContext;
import org.sonar.api.batch.DependsUpon;
+import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.MeasureUtils;
import org.sonar.api.measures.Metric;
@@ -33,23 +34,23 @@ import java.util.List;
public final class ItBranchCoverageDecorator extends AbstractCoverageDecorator {
@Override
protected Metric getTargetMetric() {
- return JaCoCoItMetrics.IT_BRANCH_COVERAGE;
+ return CoreMetrics.IT_BRANCH_COVERAGE;
}
@DependsUpon
public List<Metric> dependsUponMetrics() {
- return Arrays.asList(JaCoCoItMetrics.IT_UNCOVERED_CONDITIONS, JaCoCoItMetrics.IT_CONDITIONS_TO_COVER);
+ return Arrays.asList(CoreMetrics.IT_UNCOVERED_CONDITIONS, CoreMetrics.IT_CONDITIONS_TO_COVER);
}
@Override
protected Double countCoveredElements(DecoratorContext context) {
- double uncoveredConditions = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_UNCOVERED_CONDITIONS), 0.0);
- double conditions = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_CONDITIONS_TO_COVER), 0.0);
+ double uncoveredConditions = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_UNCOVERED_CONDITIONS), 0.0);
+ double conditions = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_CONDITIONS_TO_COVER), 0.0);
return conditions - uncoveredConditions;
}
@Override
protected Double countElements(DecoratorContext context) {
- return MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_CONDITIONS_TO_COVER), 0.0);
+ return MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_CONDITIONS_TO_COVER), 0.0);
}
}
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageDecorator.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageDecorator.java
index 49e02905895..f1bb7c63f4d 100644
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageDecorator.java
+++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageDecorator.java
@@ -21,6 +21,7 @@ package org.sonar.plugins.jacoco.itcoverage;
import org.sonar.api.batch.DecoratorContext;
import org.sonar.api.batch.DependsUpon;
+import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.MeasureUtils;
import org.sonar.api.measures.Metric;
@@ -34,27 +35,27 @@ public class ItCoverageDecorator extends AbstractCoverageDecorator {
@Override
protected Metric getTargetMetric() {
- return JaCoCoItMetrics.IT_COVERAGE;
+ return CoreMetrics.IT_COVERAGE;
}
@DependsUpon
public List<Metric> dependsUponMetrics() {
- return Arrays.asList(JaCoCoItMetrics.IT_LINES_TO_COVER, JaCoCoItMetrics.IT_UNCOVERED_LINES, JaCoCoItMetrics.IT_CONDITIONS_TO_COVER, JaCoCoItMetrics.IT_UNCOVERED_CONDITIONS);
+ return Arrays.asList(CoreMetrics.IT_LINES_TO_COVER, CoreMetrics.IT_UNCOVERED_LINES, CoreMetrics.IT_CONDITIONS_TO_COVER, CoreMetrics.IT_UNCOVERED_CONDITIONS);
}
@Override
protected Double countCoveredElements(DecoratorContext context) {
- double uncoveredLines = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_UNCOVERED_LINES), 0.0);
- double lines = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_LINES_TO_COVER), 0.0);
- double uncoveredConditions = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_UNCOVERED_CONDITIONS), 0.0);
- double conditions = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_CONDITIONS_TO_COVER), 0.0);
+ double uncoveredLines = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_UNCOVERED_LINES), 0.0);
+ double lines = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_LINES_TO_COVER), 0.0);
+ double uncoveredConditions = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_UNCOVERED_CONDITIONS), 0.0);
+ double conditions = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_CONDITIONS_TO_COVER), 0.0);
return lines + conditions - uncoveredConditions - uncoveredLines;
}
@Override
protected Double countElements(DecoratorContext context) {
- double lines = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_LINES_TO_COVER), 0.0);
- double conditions = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_CONDITIONS_TO_COVER), 0.0);
+ double lines = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_LINES_TO_COVER), 0.0);
+ double conditions = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_CONDITIONS_TO_COVER), 0.0);
return lines + conditions;
}
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItLineCoverageDecorator.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItLineCoverageDecorator.java
index 797c3f36bd7..c5e8e3bde33 100644
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItLineCoverageDecorator.java
+++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItLineCoverageDecorator.java
@@ -21,6 +21,7 @@ package org.sonar.plugins.jacoco.itcoverage;
import org.sonar.api.batch.DecoratorContext;
import org.sonar.api.batch.DependsUpon;
+import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.MeasureUtils;
import org.sonar.api.measures.Metric;
@@ -33,23 +34,23 @@ import java.util.List;
public class ItLineCoverageDecorator extends AbstractCoverageDecorator {
@Override
protected Metric getTargetMetric() {
- return JaCoCoItMetrics.IT_LINE_COVERAGE;
+ return CoreMetrics.IT_LINE_COVERAGE;
}
@DependsUpon
public List<Metric> dependsUponMetrics() {
- return Arrays.asList(JaCoCoItMetrics.IT_UNCOVERED_LINES, JaCoCoItMetrics.IT_LINES_TO_COVER);
+ return Arrays.asList(CoreMetrics.IT_UNCOVERED_LINES, CoreMetrics.IT_LINES_TO_COVER);
}
@Override
protected Double countCoveredElements(DecoratorContext context) {
- double uncoveredLines = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_UNCOVERED_LINES), 0.0);
- double lines = MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_LINES_TO_COVER), 0.0);
+ double uncoveredLines = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_UNCOVERED_LINES), 0.0);
+ double lines = MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_LINES_TO_COVER), 0.0);
return lines - uncoveredLines;
}
@Override
protected Double countElements(DecoratorContext context) {
- return MeasureUtils.getValue(context.getMeasure(JaCoCoItMetrics.IT_LINES_TO_COVER), 0.0);
+ return MeasureUtils.getValue(context.getMeasure(CoreMetrics.IT_LINES_TO_COVER), 0.0);
}
}
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItMetrics.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItMetrics.java
deleted file mode 100644
index 591d737ff81..00000000000
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItMetrics.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 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.jacoco.itcoverage;
-
-import org.sonar.api.measures.Metric;
-import org.sonar.api.measures.Metrics;
-import org.sonar.api.measures.SumChildValuesFormula;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Should be in {@link org.sonar.api.measures.CoreMetrics}
- *
- * @author Evgeny Mandrikov
- */
-public final class JaCoCoItMetrics implements Metrics {
-
- public static final String DOMAIN_IT_TESTS = "Integration Tests";
-
- public static final String IT_COVERAGE_KEY = "it_coverage";
- public static final Metric IT_COVERAGE = new Metric.Builder(IT_COVERAGE_KEY, "IT Coverage", Metric.ValueType.PERCENT)
- .setDescription("Coverage by integration tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_IT_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
-
- public static final String IT_LINES_TO_COVER_KEY = "it_lines_to_cover";
- public static final Metric IT_LINES_TO_COVER = new Metric.Builder(IT_LINES_TO_COVER_KEY, "IT lines to cover", Metric.ValueType.INT)
- .setDescription("IT lines to cover")
- .setDirection(Metric.DIRECTION_BETTER)
- .setDomain(DOMAIN_IT_TESTS)
- .setQualitative(false)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .create();
-
- public static final String IT_UNCOVERED_LINES_KEY = "it_uncovered_lines";
- public static final Metric IT_UNCOVERED_LINES = new Metric.Builder(IT_UNCOVERED_LINES_KEY, "IT uncovered lines", Metric.ValueType.INT)
- .setDescription("IT uncovered lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_IT_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .create();
-
- public static final String IT_LINE_COVERAGE_KEY = "it_line_coverage";
- public static final Metric IT_LINE_COVERAGE = new Metric.Builder(IT_LINE_COVERAGE_KEY, "IT line coverage", Metric.ValueType.PERCENT)
- .setDescription("IT line coverage")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_IT_TESTS)
- .create();
-
- public static final String IT_COVERAGE_LINE_HITS_DATA_KEY = "it_coverage_line_hits_data";
- public static final Metric IT_COVERAGE_LINE_HITS_DATA = new Metric.Builder(IT_COVERAGE_LINE_HITS_DATA_KEY, "IT Coverage hits data", Metric.ValueType.DATA)
- .setDescription("IT Code coverage line hits data")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_IT_TESTS)
- .create();
-
- public static final String IT_CONDITIONS_TO_COVER_KEY = "it_conditions_to_cover";
- public static final Metric IT_CONDITIONS_TO_COVER = new Metric.Builder(IT_CONDITIONS_TO_COVER_KEY, "IT Conditions to cover", Metric.ValueType.INT)
- .setDescription("IT Conditions to cover")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_IT_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .create();
-
- public static final String IT_UNCOVERED_CONDITIONS_KEY = "it_uncovered_conditions";
- public static final Metric IT_UNCOVERED_CONDITIONS = new Metric.Builder(IT_UNCOVERED_CONDITIONS_KEY, "IT Uncovered conditions", Metric.ValueType.INT)
- .setDescription("IT Uncovered conditions")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_IT_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .create();
-
- public static final String IT_BRANCH_COVERAGE_KEY = "it_branch_coverage";
- public static final Metric IT_BRANCH_COVERAGE = new Metric.Builder(IT_BRANCH_COVERAGE_KEY, "IT Branch coverage", Metric.ValueType.PERCENT)
- .setDescription("IT Branch coverage")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_IT_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
-
- public static final String IT_CONDITIONS_BY_LINE_KEY = "it_conditions_by_line";
-
- public static final Metric IT_CONDITIONS_BY_LINE = new Metric.Builder(IT_CONDITIONS_BY_LINE_KEY, "IT Conditions by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_IT_TESTS)
- .create();
-
- public static final String IT_COVERED_CONDITIONS_BY_LINE_KEY = "it_covered_conditions_by_line";
-
- public static final Metric IT_COVERED_CONDITIONS_BY_LINE = new Metric.Builder(IT_COVERED_CONDITIONS_BY_LINE_KEY, "IT Covered conditions by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_IT_TESTS)
- .create();
-
-
- public List<Metric> getMetrics() {
- return Arrays.asList(IT_COVERAGE, IT_LINES_TO_COVER, IT_UNCOVERED_LINES, IT_LINE_COVERAGE, IT_COVERAGE_LINE_HITS_DATA,
- IT_CONDITIONS_TO_COVER, IT_UNCOVERED_CONDITIONS, IT_BRANCH_COVERAGE,
- IT_CONDITIONS_BY_LINE, IT_COVERED_CONDITIONS_BY_LINE);
- }
-
-}
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensor.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensor.java
index f043d16dddf..8d1d54604bd 100644
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensor.java
+++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensor.java
@@ -72,25 +72,25 @@ public class JaCoCoItSensor implements Sensor {
private Measure convertForIT(Measure measure) {
Measure itMeasure = null;
if (CoreMetrics.LINES_TO_COVER.equals(measure.getMetric())) {
- itMeasure = new Measure(JaCoCoItMetrics.IT_LINES_TO_COVER, measure.getValue());
+ itMeasure = new Measure(CoreMetrics.IT_LINES_TO_COVER, measure.getValue());
} else if (CoreMetrics.UNCOVERED_LINES.equals(measure.getMetric())) {
- itMeasure = new Measure(JaCoCoItMetrics.IT_UNCOVERED_LINES, measure.getValue());
+ itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_LINES, measure.getValue());
} else if (CoreMetrics.COVERAGE_LINE_HITS_DATA.equals(measure.getMetric())) {
- itMeasure = new Measure(JaCoCoItMetrics.IT_COVERAGE_LINE_HITS_DATA, measure.getData());
+ itMeasure = new Measure(CoreMetrics.IT_COVERAGE_LINE_HITS_DATA, measure.getData());
} else if (CoreMetrics.CONDITIONS_TO_COVER.equals(measure.getMetric())) {
- itMeasure = new Measure(JaCoCoItMetrics.IT_CONDITIONS_TO_COVER, measure.getValue());
+ itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_TO_COVER, measure.getValue());
} else if (CoreMetrics.UNCOVERED_CONDITIONS.equals(measure.getMetric())) {
- itMeasure = new Measure(JaCoCoItMetrics.IT_UNCOVERED_CONDITIONS, measure.getValue());
+ itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_CONDITIONS, measure.getValue());
} else if (CoreMetrics.COVERED_CONDITIONS_BY_LINE.equals(measure.getMetric())) {
- itMeasure = new Measure(JaCoCoItMetrics.IT_COVERED_CONDITIONS_BY_LINE, measure.getData());
+ itMeasure = new Measure(CoreMetrics.IT_COVERED_CONDITIONS_BY_LINE, measure.getData());
} else if (CoreMetrics.CONDITIONS_BY_LINE.equals(measure.getMetric())) {
- itMeasure = new Measure(JaCoCoItMetrics.IT_CONDITIONS_BY_LINE, measure.getData());
+ itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_BY_LINE, measure.getData());
}
return itMeasure;
}
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewerDefinition.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewerDefinition.java
deleted file mode 100644
index 995353ca3c7..00000000000
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewerDefinition.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 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.jacoco.itcoverage.viewer;
-
-import org.sonar.api.resources.Resource;
-import org.sonar.api.web.*;
-import org.sonar.plugins.jacoco.itcoverage.JaCoCoItMetrics;
-
-@ResourceQualifier(Resource.QUALIFIER_CLASS)
-@NavigationSection(NavigationSection.RESOURCE_TAB)
-@DefaultTab(metrics = { JaCoCoItMetrics.IT_COVERAGE_KEY, JaCoCoItMetrics.IT_LINES_TO_COVER_KEY, JaCoCoItMetrics.IT_UNCOVERED_LINES_KEY, JaCoCoItMetrics.IT_LINE_COVERAGE_KEY, JaCoCoItMetrics.IT_CONDITIONS_TO_COVER_KEY, JaCoCoItMetrics.IT_UNCOVERED_CONDITIONS_KEY, JaCoCoItMetrics.IT_BRANCH_COVERAGE_KEY })
-@UserRole(UserRole.CODEVIEWER)
-public class CoverageViewerDefinition extends GwtPage {
-
- public String getTitle() {
- return "IT Coverage";
- }
-
- public String getGwtId() {
- return "org.sonar.plugins.jacoco.itcoverage.viewer.CoverageViewer";
- }
-}
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/CoveragePanel.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/CoveragePanel.java
deleted file mode 100644
index 80651a99c61..00000000000
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/CoveragePanel.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 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.jacoco.itcoverage.viewer.client;
-
-import org.sonar.gwt.ui.SourcePanel;
-import org.sonar.wsclient.gwt.AbstractCallback;
-import org.sonar.wsclient.gwt.Sonar;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Copied from org.sonar.plugins.core.coverageviewer.client.CoveragePanel
- */
-public class CoveragePanel extends SourcePanel {
-
- private Map<Integer, Integer> hitsByLine = new HashMap<Integer, Integer>();
- private Map<Integer, Integer> conditionsByLine = new HashMap<Integer, Integer>();
- private Map<Integer, Integer> coveredConditionsByLine = new HashMap<Integer, Integer>();
- private Map<Integer, String> branchCoverageByLine = new HashMap<Integer, String>();
-
- public CoveragePanel(Resource resource) {
- super(resource);
- loadCoverageHits(resource);
- }
-
- private void loadCoverageHits(Resource resource) {
- ResourceQuery query = ResourceQuery.createForResource(resource, Metrics.IT_COVERAGE_LINE_HITS_DATA, Metrics.IT_BRANCH_COVERAGE_HITS_DATA, Metrics.IT_CONDITIONS_BY_LINE, Metrics.IT_COVERED_CONDITIONS_BY_LINE);
- Sonar.getInstance().find(query, new AbstractCallback<Resource>() {
-
- @Override
- protected void doOnResponse(Resource resource) {
- handleLineHits(resource);
- handleLineConditions(resource);
- handleDeprecatedBranchCoverage(resource);
- setStarted();
- }
- });
- }
-
- private void handleLineHits(Resource resource) {
- parseDataMap(resource, Metrics.IT_COVERAGE_LINE_HITS_DATA, hitsByLine);
- }
-
- private void handleLineConditions(Resource resource) {
- parseDataMap(resource, Metrics.IT_CONDITIONS_BY_LINE, conditionsByLine);
- parseDataMap(resource, Metrics.IT_COVERED_CONDITIONS_BY_LINE, coveredConditionsByLine);
- }
-
- private void parseDataMap(Resource resource, String metric, Map<Integer, Integer> map) {
- if (resource == null || resource.getMeasure(metric) == null) {
- return;
- }
-
- map.clear();
- String data = resource.getMeasure(metric).getData();
- for (String lineWithValue : data.split(";")) {
- String[] elt = lineWithValue.split("=");
- if (elt != null && elt.length == 2) {
- map.put(Integer.parseInt(elt[0]), Integer.parseInt(elt[1]));
- }
- }
- }
-
- private void handleDeprecatedBranchCoverage(Resource resource) {
- if (resource == null || resource.getMeasure(Metrics.IT_BRANCH_COVERAGE_HITS_DATA) == null) {
- return;
- }
-
- branchCoverageByLine.clear();
- String data = resource.getMeasure(Metrics.IT_BRANCH_COVERAGE_HITS_DATA).getData();
- for (String lineWithValue : data.split(";")) {
- String[] elt = lineWithValue.split("=");
- if (elt != null && elt.length == 2) {
- branchCoverageByLine.put(Integer.parseInt(elt[0]), elt[1]);
- }
- }
- }
-
- @Override
- protected boolean shouldDecorateLine(int index) {
- return index > 0;
- }
-
- @Override
- protected List<Row> decorateLine(int index, String source) {
- Row row = new Row().setLineIndex(index, "");
-
- Integer hits = hitsByLine.get(index);
- Integer conditions = conditionsByLine.get(index);
- Integer coveredConditions = coveredConditionsByLine.get(index);
- String branchCoverage = branchCoverageByLine.get(index);
- if (branchCoverage == null && conditions != null && coveredConditions != null) {
- branchCoverage = String.valueOf(conditions - coveredConditions) + "/" + String.valueOf(conditions);
- }
-
- boolean hasLineCoverage = (hits != null);
- boolean hasBranchCoverage = (branchCoverage != null);
- boolean lineIsCovered = (hasLineCoverage && hits > 0);
- boolean branchIsCovered = ("100%".equals(branchCoverage) || (conditions != null && coveredConditions != null && coveredConditions == conditions));
-
- row.setSource(source, "");
- row.setValue("&nbsp;", "");
- row.setValue2("&nbsp;", "");
-
- if (lineIsCovered) {
- if (branchIsCovered) {
- row.setValue(String.valueOf(hits), "green");
- row.setValue2(branchCoverage, "green");
-
- } else if (hasBranchCoverage) {
- row.setValue(String.valueOf(hits), "orange");
- row.setValue2(branchCoverage, "orange");
- row.setSource(source, "orange");
- } else {
- row.setValue(String.valueOf(hits), "green");
- }
- } else if (hasLineCoverage) {
- row.setValue(String.valueOf(hits), "red");
- row.setSource(source, "red");
- if (hasBranchCoverage) {
- row.setValue2(branchCoverage, "red");
- } else {
- row.setValue2("&nbsp;", "red");
- }
- }
- return Arrays.asList(row);
- }
-}
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/CoverageViewer.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/CoverageViewer.java
deleted file mode 100644
index 1d9b3ae8c6b..00000000000
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/CoverageViewer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 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.jacoco.itcoverage.viewer.client;
-
-import org.sonar.gwt.ui.Page;
-import org.sonar.gwt.ui.ViewerHeader;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * Copied from org.sonar.plugins.core.coverageviewer.client.CoverageViewer
- */
-public class CoverageViewer extends Page {
- @Override
- protected Widget doOnResourceLoad(Resource resource) {
- FlowPanel panel = new FlowPanel();
- panel.setWidth("100%");
- panel.add(new CoverageHeader(resource));
- panel.add(new CoveragePanel(resource));
- return panel;
- }
-
- private static class CoverageHeader extends ViewerHeader {
- public CoverageHeader(Resource resource) {
- super(resource, new String[] { Metrics.IT_COVERAGE, Metrics.IT_LINE_COVERAGE, Metrics.IT_UNCOVERED_LINES, Metrics.IT_BRANCH_COVERAGE, Metrics.IT_UNCOVERED_CONDITIONS });
- }
-
- @Override
- protected void display(FlowPanel header, Resource resource) {
- HorizontalPanel panel = new HorizontalPanel();
- header.add(panel);
-
- Measure measure = resource.getMeasure(Metrics.IT_COVERAGE);
- if (measure == null) {
- addBigCell(panel, "-");
- } else {
- addBigCell(panel, measure.getFormattedValue());
- }
-
- addCell(panel, resource.getMeasure(Metrics.IT_LINE_COVERAGE));
- addCell(panel, resource.getMeasure(Metrics.IT_UNCOVERED_LINES));
- addCell(panel, resource.getMeasure(Metrics.IT_LINES_TO_COVER));
- addCell(panel, resource.getMeasure(Metrics.IT_BRANCH_COVERAGE));
- addCell(panel, resource.getMeasure(Metrics.IT_UNCOVERED_CONDITIONS));
- addCell(panel, resource.getMeasure(Metrics.IT_CONDITIONS_TO_COVER));
- }
- }
-}
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/Metrics.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/Metrics.java
deleted file mode 100644
index 3e3190f6418..00000000000
--- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/viewer/client/Metrics.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 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.jacoco.itcoverage.viewer.client;
-
-/**
- * Should be in {@link org.sonar.gwt.Metrics}
- */
-public interface Metrics {
- String IT_COVERAGE = "it_coverage";
- String IT_LINES_TO_COVER = "it_lines_to_cover";
- String IT_UNCOVERED_LINES = "it_uncovered_lines";
- String IT_LINE_COVERAGE = "it_line_coverage";
- String IT_COVERAGE_LINE_HITS_DATA = "it_coverage_line_hits_data";
- String IT_CONDITIONS_TO_COVER = "it_conditions_to_cover";
- String IT_UNCOVERED_CONDITIONS = "it_uncovered_conditions";
- String IT_BRANCH_COVERAGE = "it_branch_coverage";
- String IT_CONDITIONS_BY_LINE = "it_conditions_by_line";
- String IT_COVERED_CONDITIONS_BY_LINE = "it_covered_conditions_by_line";
-
- /**
- * @deprecated use IT_CONDITIONS_BY_LINE and IT_COVERED_CONDITIONS_BY_LINE
- */
- @Deprecated
- String IT_BRANCH_COVERAGE_HITS_DATA = "it_branch_coverage_hits_data";
-}
diff --git a/plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewer.gwt.xml b/plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewer.gwt.xml
deleted file mode 100644
index 5ab8fc9aff4..00000000000
--- a/plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewer.gwt.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<module>
- <inherits name="com.google.gwt.user.User"/>
- <inherits name="com.google.gwt.json.JSON"/>
- <inherits name="com.google.gwt.http.HTTP"/>
- <inherits name="org.sonar.Sonar"/>
- <inherits name="com.google.gwt.gen2.table.Table"/>
-
- <entry-point class="org.sonar.plugins.jacoco.itcoverage.viewer.client.CoverageViewer"/>
-</module>
diff --git a/plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewerDev.gwt.xml b/plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewerDev.gwt.xml
deleted file mode 100644
index c5a49a81f61..00000000000
--- a/plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/viewer/CoverageViewerDev.gwt.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<module rename-to="org.sonar.plugins.jacoco.itcoverage.viewer.CoverageViewer">
- <inherits name="org.sonar.plugins.jacoco.itcoverage.viewer.CoverageViewer"/>
- <inherits name="org.sonar.SonarDev"/>
-
- <entry-point class="org.sonar.plugins.jacoco.itcoverage.viewer.client.CoverageViewer"/>
-</module>
diff --git a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoPluginTest.java b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoPluginTest.java
index 33a989813b2..dd902247968 100644
--- a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoPluginTest.java
+++ b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoPluginTest.java
@@ -19,35 +19,15 @@
*/
package org.sonar.plugins.jacoco;
+import org.junit.Test;
+
import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Evgeny Mandrikov
- */
public class JaCoCoPluginTest {
- private JaCoCoPlugin plugin = new JaCoCoPlugin();
-
- @Before
- public void setUp() {
- plugin = new JaCoCoPlugin();
- }
-
- @Test
- public void testPluginDefition() {
- assertThat(plugin.getKey(), is("jacoco"));
- assertThat(plugin.getName(), notNullValue());
- assertThat(plugin.getDescription(), notNullValue());
- assertThat(plugin.toString(), is("jacoco"));
- }
@Test
public void testExtensions() {
- assertThat(plugin.getExtensions().size(), greaterThan(0));
+ assertThat(new JaCoCoPlugin().getExtensions().size(), greaterThan(0));
}
}
diff --git a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItMetricsTest.java b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItMetricsTest.java
deleted file mode 100644
index b931fb12268..00000000000
--- a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItMetricsTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 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.jacoco.itcoverage;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-public class JaCoCoItMetricsTest {
-
- @Test
- public void metricsDefinition() {
- assertThat(new JaCoCoItMetrics().getMetrics().size(), is(10));
- }
-
-}
diff --git a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensorTest.java b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensorTest.java
index aca9c9bfd9b..524e9070908 100644
--- a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensorTest.java
+++ b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensorTest.java
@@ -19,25 +19,29 @@
*/
package org.sonar.plugins.jacoco.itcoverage;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
-
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.batch.SensorContext;
+import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Measure;
-import org.sonar.api.resources.*;
+import org.sonar.api.resources.JavaFile;
+import org.sonar.api.resources.Project;
import org.sonar.api.resources.Project.AnalysisType;
+import org.sonar.api.resources.ProjectFileSystem;
+import org.sonar.api.resources.Resource;
import org.sonar.api.test.IsMeasure;
import org.sonar.plugins.jacoco.JacocoConfiguration;
import java.io.File;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.*;
+
public class JaCoCoItSensorTest {
private JacocoConfiguration configuration;
private JaCoCoItSensor sensor;
@@ -88,14 +92,14 @@ public class JaCoCoItSensorTest {
sensor.analyse(project, context);
verify(context).getResource(eq(resource));
- verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(JaCoCoItMetrics.IT_LINES_TO_COVER, 7.0)));
- verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(JaCoCoItMetrics.IT_UNCOVERED_LINES, 3.0)));
+ verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_LINES_TO_COVER, 7.0)));
+ verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_UNCOVERED_LINES, 3.0)));
verify(context).saveMeasure(eq(resource),
- argThat(new IsMeasure(JaCoCoItMetrics.IT_COVERAGE_LINE_HITS_DATA, "6=1;7=1;8=1;11=1;15=0;16=0;18=0")));
- verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(JaCoCoItMetrics.IT_CONDITIONS_TO_COVER, 2.0)));
- verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(JaCoCoItMetrics.IT_UNCOVERED_CONDITIONS, 2.0)));
- verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(JaCoCoItMetrics.IT_CONDITIONS_BY_LINE, "15=2")));
- verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(JaCoCoItMetrics.IT_COVERED_CONDITIONS_BY_LINE, "15=0")));
+ argThat(new IsMeasure(CoreMetrics.IT_COVERAGE_LINE_HITS_DATA, "6=1;7=1;8=1;11=1;15=0;16=0;18=0")));
+ verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_CONDITIONS_TO_COVER, 2.0)));
+ verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_UNCOVERED_CONDITIONS, 2.0)));
+ verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_CONDITIONS_BY_LINE, "15=2")));
+ verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_COVERED_CONDITIONS_BY_LINE, "15=0")));
verifyNoMoreInteractions(context);
}
diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
index b4d3af09832..283b3cd524b 100644
--- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
+++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
@@ -609,6 +609,14 @@ duplications.collapse=Collapse
#------------------------------------------------------------------------------
#
+# COVERAGE TAB
+#
+#------------------------------------------------------------------------------
+coverage_tab.unit_tests=Unit Tests
+coverage_tab.integration_tests=Integration Tests
+
+#------------------------------------------------------------------------------
+#
# MANUAL MEASURES
#
#------------------------------------------------------------------------------
@@ -917,6 +925,7 @@ severity.INFO=Info
metric_domain.Size=Size
metric_domain.Tests=Tests
+metric_domain.Integration Tests=L10n Integration Tests
metric_domain.Complexity=Complexity
metric_domain.Documentation=Documentation
metric_domain.Rules=Rules
@@ -1103,6 +1112,43 @@ metric.conditions_by_line.description=Branches by line
metric.covered_conditions_by_line.name=Covered branches by line
metric.covered_conditions_by_line.description=Covered branches by line
+
+#--------------------------------------------------------------------------------------------------------------------
+#
+# INTEGRATION TESTS
+#
+#--------------------------------------------------------------------------------------------------------------------
+
+metric.it_coverage.name=Coverage
+metric.it_coverage.description=Coverage by unit tests
+
+metric.it_lines_to_cover.name=Lines to cover
+metric.it_lines_to_cover.description=Lines to cover
+
+metric.it_uncovered_lines.name=Uncovered lines
+metric.it_uncovered_lines.description=Uncovered lines
+
+metric.it_line_coverage.name=Line coverage
+metric.it_line_coverage.description=Line coverage
+
+metric.it_coverage_line_hits_data.name=Coverage hits by line
+metric.it_coverage_line_hits_data.description=Coverage hits by line
+
+metric.it_conditions_to_cover.name=Branches to cover
+metric.it_conditions_to_cover.description=Branches to cover
+
+metric.it_uncovered_conditions.name=Uncovered branches
+metric.it_uncovered_conditions.description=Uncovered branches
+
+metric.it_branch_coverage.name=Branch coverage
+metric.it_branch_coverage.description=Branch coverage
+
+metric.it_conditions_by_line.name=Branches by line
+metric.it_conditions_by_line.description=Branches by line
+
+metric.it_covered_conditions_by_line.name=Covered branches by line
+metric.it_covered_conditions_by_line.description=Covered branches by line
+
#--------------------------------------------------------------------------------------------------------------------
#
# DUPLICATIONS
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
index a4f2114d6db..555d753440a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
@@ -38,6 +38,7 @@ public final class CoreMetrics {
public static final String DOMAIN_SIZE = "Size";
public static final String DOMAIN_TESTS = "Tests";
+ public static final String DOMAIN_INTEGRATION_TESTS = "Integration Tests";
public static final String DOMAIN_COMPLEXITY = "Complexity";
public static final String DOMAIN_DOCUMENTATION = "Documentation";
public static final String DOMAIN_RULES = "Rules";
@@ -55,122 +56,122 @@ public final class CoreMetrics {
public static final String LINES_KEY = "lines";
public static final Metric LINES = new Metric.Builder(LINES_KEY, "Lines", Metric.ValueType.INT)
- .setDescription("Lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String GENERATED_LINES_KEY = "generated_lines";
public static final Metric GENERATED_LINES = new Metric.Builder(GENERATED_LINES_KEY, "Generated Lines", Metric.ValueType.INT)
- .setDescription("Number of generated lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Number of generated lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String NCLOC_KEY = "ncloc";
public static final Metric NCLOC = new Metric.Builder(NCLOC_KEY, "Lines of code", Metric.ValueType.INT)
- .setDescription("Non Commenting Lines of Code")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Non Commenting Lines of Code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String GENERATED_NCLOC_KEY = "generated_ncloc";
public static final Metric GENERATED_NCLOC = new Metric.Builder(GENERATED_NCLOC_KEY, "Generated lines of code", Metric.ValueType.INT)
- .setDescription("Generated non Commenting Lines of Code")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Generated non Commenting Lines of Code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String CLASSES_KEY = "classes";
public static final Metric CLASSES = new Metric.Builder(CLASSES_KEY, "Classes", Metric.ValueType.INT)
- .setDescription("Classes")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Classes")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String FILES_KEY = "files";
public static final Metric FILES = new Metric.Builder(FILES_KEY, "Files", Metric.ValueType.INT)
- .setDescription("Number of files")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .create();
+ .setDescription("Number of files")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .create();
public static final String DIRECTORIES_KEY = "directories";
public static final Metric DIRECTORIES = new Metric.Builder(DIRECTORIES_KEY, "Directories", Metric.ValueType.INT)
- .setDescription("Directories")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .create();
+ .setDescription("Directories")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .create();
public static final String PACKAGES_KEY = "packages";
public static final Metric PACKAGES = new Metric.Builder(PACKAGES_KEY, "Packages", Metric.ValueType.INT)
- .setDescription("Packages")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Packages")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String FUNCTIONS_KEY = "functions";
public static final Metric FUNCTIONS = new Metric.Builder(FUNCTIONS_KEY, "Methods", Metric.ValueType.INT)
- .setDescription("Methods")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Methods")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String ACCESSORS_KEY = "accessors";
public static final Metric ACCESSORS = new Metric.Builder(ACCESSORS_KEY, "Accessors", Metric.ValueType.INT)
- .setDescription("Accessors")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Accessors")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String PARAGRAPHS_KEY = "paragraphs";
public static final Metric PARAGRAPHS = new Metric.Builder(PARAGRAPHS_KEY, "Paragraphs", Metric.ValueType.INT)
- .setDescription("Number of paragraphs")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Number of paragraphs")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String STATEMENTS_KEY = "statements";
public static final Metric STATEMENTS = new Metric.Builder(STATEMENTS_KEY, "Statements", Metric.ValueType.INT)
- .setDescription("Number of statements")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Number of statements")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String PUBLIC_API_KEY = "public_api";
public static final Metric PUBLIC_API = new Metric.Builder(PUBLIC_API_KEY, "Public API", Metric.ValueType.INT)
- .setDescription("Public API")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Public API")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
//--------------------------------------------------------------------------------------------------------------------
@@ -181,65 +182,65 @@ public final class CoreMetrics {
public static final String COMMENT_LINES_KEY = "comment_lines";
public static final Metric COMMENT_LINES = new Metric.Builder(COMMENT_LINES_KEY, "Comment lines", Metric.ValueType.INT)
- .setDescription("Number of comment lines")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Number of comment lines")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String COMMENT_LINES_DENSITY_KEY = "comment_lines_density";
public static final Metric COMMENT_LINES_DENSITY = new Metric.Builder(COMMENT_LINES_DENSITY_KEY, "Comments (%)", Metric.ValueType.PERCENT)
- .setDescription("Comments balanced by ncloc + comment lines")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_DOCUMENTATION)
- .create();
+ .setDescription("Comments balanced by ncloc + comment lines")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .create();
public static final String COMMENT_BLANK_LINES_KEY = "comment_blank_lines";
public static final Metric COMMENT_BLANK_LINES = new Metric.Builder(COMMENT_BLANK_LINES_KEY, "Blank comments", Metric.ValueType.INT)
- .setDescription("Comments that do not contain comments")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Comments that do not contain comments")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String PUBLIC_DOCUMENTED_API_DENSITY_KEY = "public_documented_api_density";
public static final Metric PUBLIC_DOCUMENTED_API_DENSITY = new Metric.Builder(PUBLIC_DOCUMENTED_API_DENSITY_KEY, "Public documented API (%)", Metric.ValueType.PERCENT)
- .setDescription("Public documented classes and methods balanced by ncloc")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Public documented classes and methods balanced by ncloc")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String PUBLIC_UNDOCUMENTED_API_KEY = "public_undocumented_api";
public static final Metric PUBLIC_UNDOCUMENTED_API = new Metric.Builder(PUBLIC_UNDOCUMENTED_API_KEY, "Public undocumented API", Metric.ValueType.INT)
- .setDescription("Public undocumented classes, methods and variables")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setBestValue(0.0)
- .setDirection(Metric.DIRECTION_WORST)
- .setOptimizedBestValue(true)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Public undocumented classes, methods and variables")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setBestValue(0.0)
+ .setDirection(Metric.DIRECTION_WORST)
+ .setOptimizedBestValue(true)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String COMMENTED_OUT_CODE_LINES_KEY = "commented_out_code_lines";
public static final Metric COMMENTED_OUT_CODE_LINES = new Metric.Builder(COMMENTED_OUT_CODE_LINES_KEY, "Commented-out LOC", Metric.ValueType.INT)
- .setDescription("Commented lines of code")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Commented lines of code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
//--------------------------------------------------------------------------------------------------------------------
@@ -250,84 +251,84 @@ public final class CoreMetrics {
public static final String COMPLEXITY_KEY = "complexity";
public static final Metric COMPLEXITY = new Metric.Builder(COMPLEXITY_KEY, "Complexity", Metric.ValueType.INT)
- .setDescription("Cyclomatic complexity")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Cyclomatic complexity")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String CLASS_COMPLEXITY_KEY = "class_complexity";
public static final Metric CLASS_COMPLEXITY = new Metric.Builder(CLASS_COMPLEXITY_KEY, "Complexity /class", Metric.ValueType.FLOAT)
- .setDescription("Complexity average by class")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new AverageComplexityFormula(CoreMetrics.CLASSES))
- .create();
+ .setDescription("Complexity average by class")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new AverageComplexityFormula(CoreMetrics.CLASSES))
+ .create();
public static final String FUNCTION_COMPLEXITY_KEY = "function_complexity";
public static final Metric FUNCTION_COMPLEXITY = new Metric.Builder(FUNCTION_COMPLEXITY_KEY, "Complexity /method", Metric.ValueType.FLOAT)
- .setDescription("Complexity average by method")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new AverageComplexityFormula(CoreMetrics.FUNCTIONS))
- .create();
+ .setDescription("Complexity average by method")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new AverageComplexityFormula(CoreMetrics.FUNCTIONS))
+ .create();
public static final String FILE_COMPLEXITY_KEY = "file_complexity";
public static final Metric FILE_COMPLEXITY = new Metric.Builder(FILE_COMPLEXITY_KEY, "Complexity /file", Metric.ValueType.FLOAT)
- .setDescription("Complexity average by file")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new AverageComplexityFormula(CoreMetrics.FILES))
- .create();
+ .setDescription("Complexity average by file")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new AverageComplexityFormula(CoreMetrics.FILES))
+ .create();
public static final String PARAGRAPH_COMPLEXITY_KEY = "paragraph_complexity";
public static final Metric PARAGRAPH_COMPLEXITY = new Metric.Builder(PARAGRAPH_COMPLEXITY_KEY, "Complexity /paragraph", Metric.ValueType.FLOAT)
- .setDescription("Complexity average by paragraph")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new AverageComplexityFormula(CoreMetrics.PARAGRAPHS))
- .create();
+ .setDescription("Complexity average by paragraph")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new AverageComplexityFormula(CoreMetrics.PARAGRAPHS))
+ .create();
public static final String CLASS_COMPLEXITY_DISTRIBUTION_KEY = "class_complexity_distribution";
public static final Metric CLASS_COMPLEXITY_DISTRIBUTION = new Metric.Builder(CLASS_COMPLEXITY_DISTRIBUTION_KEY, "Classes distribution /complexity", Metric.ValueType.DISTRIB)
- .setDescription("Classes distribution /complexity")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Classes distribution /complexity")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
public static final String FUNCTION_COMPLEXITY_DISTRIBUTION_KEY = "function_complexity_distribution";
public static final Metric FUNCTION_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FUNCTION_COMPLEXITY_DISTRIBUTION_KEY, "Functions distribution /complexity", Metric.ValueType.DISTRIB)
- .setDescription("Functions distribution /complexity")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Functions distribution /complexity")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
public static final String FILE_COMPLEXITY_DISTRIBUTION_KEY = "file_complexity_distribution";
public static final Metric FILE_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FILE_COMPLEXITY_DISTRIBUTION_KEY, "Files distribution /complexity", Metric.ValueType.DISTRIB)
- .setDescription("Files distribution /complexity")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Files distribution /complexity")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
public static final String PARAGRAPH_COMPLEXITY_DISTRIBUTION_KEY = "paragraph_complexity_distribution";
public static final Metric PARAGRAPH_COMPLEXITY_DISTRIBUTION = new Metric.Builder(PARAGRAPH_COMPLEXITY_DISTRIBUTION_KEY, "Paragraph distribution /complexity", Metric.ValueType.DISTRIB)
- .setDescription("Paragraph distribution /complexity")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Paragraph distribution /complexity")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
//--------------------------------------------------------------------------------------------------------------------
//
@@ -347,87 +348,87 @@ public final class CoreMetrics {
* </ul>
*/
public static final Metric TESTS = new Metric.Builder(TESTS_KEY, "Unit tests", Metric.ValueType.INT)
- .setDescription("Number of unit tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDescription("Number of unit tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String TEST_EXECUTION_TIME_KEY = "test_execution_time";
public static final Metric TEST_EXECUTION_TIME = new Metric.Builder(TEST_EXECUTION_TIME_KEY, "Unit tests duration", Metric.ValueType.MILLISEC)
- .setDescription("Execution duration of unit tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDescription("Execution duration of unit tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String TEST_ERRORS_KEY = "test_errors";
public static final Metric TEST_ERRORS = new Metric.Builder(TEST_ERRORS_KEY, "Unit test errors", Metric.ValueType.INT)
- .setDescription("Number of unit test errors")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Number of unit test errors")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String SKIPPED_TESTS_KEY = "skipped_tests";
public static final Metric SKIPPED_TESTS = new Metric.Builder(SKIPPED_TESTS_KEY, "Skipped unit tests", Metric.ValueType.INT)
- .setDescription("Number of skipped unit tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Number of skipped unit tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String TEST_FAILURES_KEY = "test_failures";
public static final Metric TEST_FAILURES = new Metric.Builder(TEST_FAILURES_KEY, "Unit test failures", Metric.ValueType.INT)
- .setDescription("Number of unit test failures")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Number of unit test failures")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String TEST_SUCCESS_DENSITY_KEY = "test_success_density";
public static final Metric TEST_SUCCESS_DENSITY = new Metric.Builder(TEST_SUCCESS_DENSITY_KEY, "Unit test success (%)", Metric.ValueType.PERCENT)
- .setDescription("Density of successful unit tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Density of successful unit tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String TEST_DATA_KEY = "test_data";
public static final Metric TEST_DATA = new Metric.Builder(TEST_DATA_KEY, "Unit tests details", Metric.ValueType.DATA)
- .setDescription("Unit tests details")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDescription("Unit tests details")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String COVERAGE_KEY = "coverage";
public static final Metric COVERAGE = new Metric.Builder(COVERAGE_KEY, "Coverage", Metric.ValueType.PERCENT)
- .setDescription("Coverage by unit tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Coverage by unit tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
public static final String NEW_COVERAGE_KEY = "new_coverage";
public static final Metric NEW_COVERAGE = new Metric.Builder(NEW_COVERAGE_KEY, "New coverage", Metric.ValueType.PERCENT)
- .setDescription("Coverage of new/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Coverage of new/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
public static final String LINES_TO_COVER_KEY = "lines_to_cover";
@@ -435,22 +436,22 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric LINES_TO_COVER = new Metric.Builder(LINES_TO_COVER_KEY, "Lines to cover", Metric.ValueType.INT)
- .setDescription("Lines to cover")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .create();
+ .setDescription("Lines to cover")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .create();
public static final String NEW_LINES_TO_COVER_KEY = "new_lines_to_cover";
public static final Metric NEW_LINES_TO_COVER = new Metric.Builder(NEW_LINES_TO_COVER_KEY, "New lines to cover", Metric.ValueType.INT)
- .setDescription("New lines to cover")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("New lines to cover")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String UNCOVERED_LINES_KEY = "uncovered_lines";
@@ -458,41 +459,41 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric UNCOVERED_LINES = new Metric.Builder(UNCOVERED_LINES_KEY, "Uncovered lines", Metric.ValueType.INT)
- .setDescription("Uncovered lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .create();
+ .setDescription("Uncovered lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .create();
public static final String NEW_UNCOVERED_LINES_KEY = "new_uncovered_lines";
public static final Metric NEW_UNCOVERED_LINES = new Metric.Builder(NEW_UNCOVERED_LINES_KEY, "New uncovered lines", Metric.ValueType.INT)
- .setDescription("New uncovered lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .create();
+ .setDescription("New uncovered lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .create();
public static final String LINE_COVERAGE_KEY = "line_coverage";
public static final Metric LINE_COVERAGE = new Metric.Builder(LINE_COVERAGE_KEY, "Line coverage", Metric.ValueType.PERCENT)
- .setDescription("Line coverage")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Line coverage")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
public static final String NEW_LINE_COVERAGE_KEY = "new_line_coverage";
public static final Metric NEW_LINE_COVERAGE = new Metric.Builder(NEW_LINE_COVERAGE_KEY, "New line coverage", Metric.ValueType.PERCENT)
- .setDescription("Line coverage of added/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDescription("Line coverage of added/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String COVERAGE_LINE_HITS_DATA_KEY = "coverage_line_hits_data";
@@ -500,8 +501,8 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric COVERAGE_LINE_HITS_DATA = new Metric.Builder(COVERAGE_LINE_HITS_DATA_KEY, "Coverage hits by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String CONDITIONS_TO_COVER_KEY = "conditions_to_cover";
@@ -509,18 +510,18 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric CONDITIONS_TO_COVER = new Metric.Builder(CONDITIONS_TO_COVER_KEY, "Conditions to cover", Metric.ValueType.INT)
- .setDescription("Conditions to cover")
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .create();
+ .setDescription("Conditions to cover")
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .create();
public static final String NEW_CONDITIONS_TO_COVER_KEY = "new_conditions_to_cover";
public static final Metric NEW_CONDITIONS_TO_COVER = new Metric.Builder(NEW_CONDITIONS_TO_COVER_KEY, "New conditions to cover", Metric.ValueType.INT)
- .setDescription("New conditions to cover")
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("New conditions to cover")
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String UNCOVERED_CONDITIONS_KEY = "uncovered_conditions";
@@ -528,41 +529,41 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric UNCOVERED_CONDITIONS = new Metric.Builder(UNCOVERED_CONDITIONS_KEY, "Uncovered conditions", Metric.ValueType.INT)
- .setDescription("Uncovered conditions")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .create();
+ .setDescription("Uncovered conditions")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .create();
public static final String NEW_UNCOVERED_CONDITIONS_KEY = "new_uncovered_conditions";
public static final Metric NEW_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_UNCOVERED_CONDITIONS_KEY, "New uncovered conditions", Metric.ValueType.INT)
- .setDescription("New uncovered conditions")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .create();
+ .setDescription("New uncovered conditions")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .create();
public static final String BRANCH_COVERAGE_KEY = "branch_coverage";
public static final Metric BRANCH_COVERAGE = new Metric.Builder(BRANCH_COVERAGE_KEY, "Branch coverage", Metric.ValueType.PERCENT)
- .setDescription("Branch coverage")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Branch coverage")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
public static final String NEW_BRANCH_COVERAGE_KEY = "new_branch_coverage";
public static final Metric NEW_BRANCH_COVERAGE = new Metric.Builder(NEW_BRANCH_COVERAGE_KEY, "New branch coverage", Metric.ValueType.PERCENT)
- .setDescription("Branch coverage of new/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Branch coverage of new/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
/**
* @deprecated in 2.7. Replaced by {@link #CONDITIONS_BY_LINE_KEY} and {@link #COVERED_CONDITIONS_BY_LINE_KEY}
@@ -575,8 +576,8 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric BRANCH_COVERAGE_HITS_DATA = new Metric.Builder(BRANCH_COVERAGE_HITS_DATA_KEY, "Branch coverage hits", Metric.ValueType.DATA)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String CONDITIONS_BY_LINE_KEY = "conditions_by_line";
@@ -586,8 +587,8 @@ public final class CoreMetrics {
* @since 2.7
*/
public static final Metric CONDITIONS_BY_LINE = new Metric.Builder(CONDITIONS_BY_LINE_KEY, "Conditions by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String COVERED_CONDITIONS_BY_LINE_KEY = "covered_conditions_by_line";
@@ -597,8 +598,100 @@ public final class CoreMetrics {
* @since 2.7
*/
public static final Metric COVERED_CONDITIONS_BY_LINE = new Metric.Builder(COVERED_CONDITIONS_BY_LINE_KEY, "Covered conditions by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDomain(DOMAIN_TESTS)
+ .create();
+
+
+ //--------------------------------------------------------------------------------------------------------------------
+ //
+ // INTEGRATION TESTS
+ //
+ //--------------------------------------------------------------------------------------------------------------------
+
+ public static final String IT_COVERAGE_KEY = "it_coverage";
+ public static final Metric IT_COVERAGE = new Metric.Builder(IT_COVERAGE_KEY, "IT Coverage", Metric.ValueType.PERCENT)
+ .setDescription("Coverage by integration tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
+
+ public static final String IT_LINES_TO_COVER_KEY = "it_lines_to_cover";
+ public static final Metric IT_LINES_TO_COVER = new Metric.Builder(IT_LINES_TO_COVER_KEY, "IT Lines to cover", Metric.ValueType.INT)
+ .setDescription("IT lines to cover")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setQualitative(false)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .create();
+
+ public static final String IT_UNCOVERED_LINES_KEY = "it_uncovered_lines";
+ public static final Metric IT_UNCOVERED_LINES = new Metric.Builder(IT_UNCOVERED_LINES_KEY, "IT Uncovered lines", Metric.ValueType.INT)
+ .setDescription("IT uncovered lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
+
+ public static final String IT_LINE_COVERAGE_KEY = "it_line_coverage";
+ public static final Metric IT_LINE_COVERAGE = new Metric.Builder(IT_LINE_COVERAGE_KEY, "IT Line coverage", Metric.ValueType.PERCENT)
+ .setDescription("IT line coverage")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .create();
+
+ public static final String IT_COVERAGE_LINE_HITS_DATA_KEY = "it_coverage_line_hits_data";
+ public static final Metric IT_COVERAGE_LINE_HITS_DATA = new Metric.Builder(IT_COVERAGE_LINE_HITS_DATA_KEY, "IT Coverage hits data", Metric.ValueType.DATA)
+ .setDescription("IT Code coverage line hits data")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .create();
+
+ public static final String IT_CONDITIONS_TO_COVER_KEY = "it_conditions_to_cover";
+ public static final Metric IT_CONDITIONS_TO_COVER = new Metric.Builder(IT_CONDITIONS_TO_COVER_KEY, "IT Branches to cover", Metric.ValueType.INT)
+ .setDescription("IT Conditions to cover")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .create();
+
+ public static final String IT_UNCOVERED_CONDITIONS_KEY = "it_uncovered_conditions";
+ public static final Metric IT_UNCOVERED_CONDITIONS = new Metric.Builder(IT_UNCOVERED_CONDITIONS_KEY, "IT Uncovered branches", Metric.ValueType.INT)
+ .setDescription("IT Uncovered conditions")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
+
+ public static final String IT_BRANCH_COVERAGE_KEY = "it_branch_coverage";
+ public static final Metric IT_BRANCH_COVERAGE = new Metric.Builder(IT_BRANCH_COVERAGE_KEY, "IT Branch coverage", Metric.ValueType.PERCENT)
+ .setDescription("IT Branch coverage")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
+
+ public static final String IT_CONDITIONS_BY_LINE_KEY = "it_conditions_by_line";
+
+ public static final Metric IT_CONDITIONS_BY_LINE = new Metric.Builder(IT_CONDITIONS_BY_LINE_KEY, "IT Branches by line", Metric.ValueType.DATA)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .create();
+
+ public static final String IT_COVERED_CONDITIONS_BY_LINE_KEY = "it_covered_conditions_by_line";
+
+ public static final Metric IT_COVERED_CONDITIONS_BY_LINE = new Metric.Builder(IT_COVERED_CONDITIONS_BY_LINE_KEY, "IT Covered branches by line", Metric.ValueType.DATA)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .create();
//--------------------------------------------------------------------------------------------------------------------
@@ -609,50 +702,50 @@ public final class CoreMetrics {
public static final String DUPLICATED_LINES_KEY = "duplicated_lines";
public static final Metric DUPLICATED_LINES = new Metric.Builder(DUPLICATED_LINES_KEY, "Duplicated lines", Metric.ValueType.INT)
- .setDescription("Duplicated lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_DUPLICATION)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Duplicated lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_DUPLICATION)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String DUPLICATED_BLOCKS_KEY = "duplicated_blocks";
public static final Metric DUPLICATED_BLOCKS = new Metric.Builder(DUPLICATED_BLOCKS_KEY, "Duplicated blocks", Metric.ValueType.INT)
- .setDescription("Duplicated blocks")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_DUPLICATION)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Duplicated blocks")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_DUPLICATION)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String DUPLICATED_FILES_KEY = "duplicated_files";
public static final Metric DUPLICATED_FILES = new Metric.Builder(DUPLICATED_FILES_KEY, "Duplicated files", Metric.ValueType.INT)
- .setDescription("Duplicated files")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DUPLICATION)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Duplicated files")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DUPLICATION)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String DUPLICATED_LINES_DENSITY_KEY = "duplicated_lines_density";
public static final Metric DUPLICATED_LINES_DENSITY = new Metric.Builder(DUPLICATED_LINES_DENSITY_KEY, "Duplicated lines (%)", Metric.ValueType.PERCENT)
- .setDescription("Duplicated lines balanced by statements")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DUPLICATION)
- .setWorstValue(50.0)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Duplicated lines balanced by statements")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DUPLICATION)
+ .setWorstValue(50.0)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String DUPLICATIONS_DATA_KEY = "duplications_data";
public static final Metric DUPLICATIONS_DATA = new Metric.Builder(DUPLICATIONS_DATA_KEY, "Duplications details", Metric.ValueType.DATA)
- .setDescription("Duplications details")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DUPLICATION)
- .create();
+ .setDescription("Duplications details")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DUPLICATION)
+ .create();
//--------------------------------------------------------------------------------------------------------------------
@@ -671,7 +764,7 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric USABILITY = new Metric(USABILITY_KEY, "Usability", "Usability", Metric.ValueType.PERCENT,
- Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true);
+ Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true);
/**
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007
@@ -684,7 +777,7 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric RELIABILITY = new Metric(RELIABILITY_KEY, "Reliability", "Reliability", Metric.ValueType.PERCENT,
- Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true);
+ Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true);
/**
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007
@@ -697,7 +790,7 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric EFFICIENCY = new Metric(EFFICIENCY_KEY, "Efficiency", "Efficiency", Metric.ValueType.PERCENT,
- Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true);
+ Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true);
/**
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007
@@ -710,7 +803,7 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric PORTABILITY = new Metric(PORTABILITY_KEY, "Portability", "Portability", Metric.ValueType.PERCENT,
- Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true);
+ Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true);
/**
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007
@@ -723,149 +816,149 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric MAINTAINABILITY = new Metric.Builder(MAINTAINABILITY_KEY, "Maintainability", Metric.ValueType.PERCENT)
- .setDescription("Maintainability")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_RULE_CATEGORIES)
- .setBestValue(100.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Maintainability")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_RULE_CATEGORIES)
+ .setBestValue(100.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String WEIGHTED_VIOLATIONS_KEY = "weighted_violations";
public static final Metric WEIGHTED_VIOLATIONS = new Metric.Builder(WEIGHTED_VIOLATIONS_KEY, "Weighted violations", Metric.ValueType.INT)
- .setDescription("Weighted Violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_RULES)
- .create();
+ .setDescription("Weighted Violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_RULES)
+ .create();
public static final String VIOLATIONS_DENSITY_KEY = "violations_density";
public static final Metric VIOLATIONS_DENSITY = new Metric.Builder(VIOLATIONS_DENSITY_KEY, "Rules compliance", Metric.ValueType.PERCENT)
- .setDescription("Rules compliance")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_RULES)
- .create();
+ .setDescription("Rules compliance")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_RULES)
+ .create();
public static final String VIOLATIONS_KEY = "violations";
public static final Metric VIOLATIONS = new Metric.Builder(VIOLATIONS_KEY, "Violations", Metric.ValueType.INT)
- .setDescription("Violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String BLOCKER_VIOLATIONS_KEY = "blocker_violations";
public static final Metric BLOCKER_VIOLATIONS = new Metric.Builder(BLOCKER_VIOLATIONS_KEY, "Blocker violations", Metric.ValueType.INT)
- .setDescription("Blocker violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Blocker violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String CRITICAL_VIOLATIONS_KEY = "critical_violations";
public static final Metric CRITICAL_VIOLATIONS = new Metric.Builder(CRITICAL_VIOLATIONS_KEY, "Critical violations", Metric.ValueType.INT)
- .setDescription("Critical violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Critical violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String MAJOR_VIOLATIONS_KEY = "major_violations";
public static final Metric MAJOR_VIOLATIONS = new Metric.Builder(MAJOR_VIOLATIONS_KEY, "Major violations", Metric.ValueType.INT)
- .setDescription("Major violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Major violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String MINOR_VIOLATIONS_KEY = "minor_violations";
public static final Metric MINOR_VIOLATIONS = new Metric.Builder(MINOR_VIOLATIONS_KEY, "Minor violations", Metric.ValueType.INT)
- .setDescription("Minor violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Minor violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String INFO_VIOLATIONS_KEY = "info_violations";
public static final Metric INFO_VIOLATIONS = new Metric.Builder(INFO_VIOLATIONS_KEY, "Info violations", Metric.ValueType.INT)
- .setDescription("Info violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Info violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String NEW_VIOLATIONS_KEY = "new_violations";
public static final Metric NEW_VIOLATIONS = new Metric.Builder(NEW_VIOLATIONS_KEY, "New Violations", Metric.ValueType.INT)
- .setDescription("New Violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("New Violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String NEW_BLOCKER_VIOLATIONS_KEY = "new_blocker_violations";
public static final Metric NEW_BLOCKER_VIOLATIONS = new Metric.Builder(NEW_BLOCKER_VIOLATIONS_KEY, "New Blocker violations", Metric.ValueType.INT)
- .setDescription("New Blocker violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("New Blocker violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String NEW_CRITICAL_VIOLATIONS_KEY = "new_critical_violations";
public static final Metric NEW_CRITICAL_VIOLATIONS = new Metric.Builder(NEW_CRITICAL_VIOLATIONS_KEY, "New Critical violations", Metric.ValueType.INT)
- .setDescription("New Critical violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("New Critical violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String NEW_MAJOR_VIOLATIONS_KEY = "new_major_violations";
public static final Metric NEW_MAJOR_VIOLATIONS = new Metric.Builder(NEW_MAJOR_VIOLATIONS_KEY, "New Major violations", Metric.ValueType.INT)
- .setDescription("New Major violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("New Major violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String NEW_MINOR_VIOLATIONS_KEY = "new_minor_violations";
public static final Metric NEW_MINOR_VIOLATIONS = new Metric.Builder(NEW_MINOR_VIOLATIONS_KEY, "New Minor violations", Metric.ValueType.INT)
- .setDescription("New Minor violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("New Minor violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String NEW_INFO_VIOLATIONS_KEY = "new_info_violations";
public static final Metric NEW_INFO_VIOLATIONS = new Metric.Builder(NEW_INFO_VIOLATIONS_KEY, "New Info violations", Metric.ValueType.INT)
- .setDescription("New Info violations")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_RULES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("New Info violations")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_RULES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
//--------------------------------------------------------------------------------------------------------------------
@@ -876,211 +969,211 @@ public final class CoreMetrics {
public static final String ABSTRACTNESS_KEY = "abstractness";
public static final Metric ABSTRACTNESS = new Metric.Builder(ABSTRACTNESS_KEY, "Abstractness", Metric.ValueType.PERCENT)
- .setDescription("Abstractness")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Abstractness")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String INSTABILITY_KEY = "instability";
public static final Metric INSTABILITY = new Metric.Builder(INSTABILITY_KEY, "Instability", Metric.ValueType.PERCENT)
- .setDescription("Instability")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Instability")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String DISTANCE_KEY = "distance";
public static final Metric DISTANCE = new Metric.Builder(DISTANCE_KEY, "Distance", Metric.ValueType.FLOAT)
- .setDescription("Distance")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Distance")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String DEPTH_IN_TREE_KEY = "dit";
public static final Metric DEPTH_IN_TREE = new Metric.Builder(DEPTH_IN_TREE_KEY, "Depth in Tree", Metric.ValueType.INT)
- .setDescription("Depth in Inheritance Tree")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Depth in Inheritance Tree")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String NUMBER_OF_CHILDREN_KEY = "noc";
public static final Metric NUMBER_OF_CHILDREN = new Metric.Builder(NUMBER_OF_CHILDREN_KEY, "Number of Children", Metric.ValueType.INT)
- .setDescription("Number of Children")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Number of Children")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String RFC_KEY = "rfc";
public static final Metric RFC = new Metric.Builder(RFC_KEY, "RFC", Metric.ValueType.INT)
- .setDescription("Response for Class")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new WeightedMeanAggregationFormula(CoreMetrics.FILES, false))
- .create();
+ .setDescription("Response for Class")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new WeightedMeanAggregationFormula(CoreMetrics.FILES, false))
+ .create();
public static final String RFC_DISTRIBUTION_KEY = "rfc_distribution";
public static final Metric RFC_DISTRIBUTION = new Metric.Builder(RFC_DISTRIBUTION_KEY, "Class distribution /RFC", Metric.ValueType.DISTRIB)
- .setDescription("Class distribution /RFC")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Class distribution /RFC")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
public static final String LCOM4_KEY = "lcom4";
public static final Metric LCOM4 = new Metric.Builder(LCOM4_KEY, "LCOM4", Metric.ValueType.FLOAT)
- .setDescription("Lack of Cohesion of Methods")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setBestValue(1.0)
- .setFormula(new WeightedMeanAggregationFormula(CoreMetrics.FILES, false))
- .create();
+ .setDescription("Lack of Cohesion of Methods")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setBestValue(1.0)
+ .setFormula(new WeightedMeanAggregationFormula(CoreMetrics.FILES, false))
+ .create();
public static final String LCOM4_BLOCKS_KEY = "lcom4_blocks";
public static final Metric LCOM4_BLOCKS = new Metric.Builder(LCOM4_BLOCKS_KEY, "LCOM4 blocks", Metric.ValueType.DATA)
- .setDescription("LCOM4 blocks")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("LCOM4 blocks")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
public static final String LCOM4_DISTRIBUTION_KEY = "lcom4_distribution";
public static final Metric LCOM4_DISTRIBUTION = new Metric.Builder(LCOM4_DISTRIBUTION_KEY, "Class distribution /LCOM4", Metric.ValueType.DISTRIB)
- .setDescription("Class distribution /LCOM4")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Class distribution /LCOM4")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
public static final String SUSPECT_LCOM4_DENSITY_KEY = "suspect_lcom4_density";
public static final Metric SUSPECT_LCOM4_DENSITY = new Metric.Builder(SUSPECT_LCOM4_DENSITY_KEY, "Suspect LCOM4 density", Metric.ValueType.PERCENT)
- .setDescription("Density of classes having LCOM4>1")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Density of classes having LCOM4>1")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String AFFERENT_COUPLINGS_KEY = "ca";
public static final Metric AFFERENT_COUPLINGS = new Metric.Builder(AFFERENT_COUPLINGS_KEY, "Afferent couplings", Metric.ValueType.INT)
- .setDescription("Afferent couplings")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Afferent couplings")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String EFFERENT_COUPLINGS_KEY = "ce";
public static final Metric EFFERENT_COUPLINGS = new Metric.Builder(EFFERENT_COUPLINGS_KEY, "Efferent couplings", Metric.ValueType.INT)
- .setDescription("Efferent couplings")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Efferent couplings")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String DEPENDENCY_MATRIX_KEY = "dsm";
public static final Metric DEPENDENCY_MATRIX = new Metric.Builder(DEPENDENCY_MATRIX_KEY, "Dependency Matrix", Metric.ValueType.DATA)
- .setDescription("Dependency Matrix")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Dependency Matrix")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String PACKAGE_CYCLES_KEY = "package_cycles";
public static final Metric PACKAGE_CYCLES = new Metric.Builder(PACKAGE_CYCLES_KEY, "Package cycles", Metric.ValueType.INT)
- .setDescription("Package cycles")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Package cycles")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String PACKAGE_TANGLE_INDEX_KEY = "package_tangle_index";
public static final Metric PACKAGE_TANGLE_INDEX = new Metric.Builder(PACKAGE_TANGLE_INDEX_KEY, "Package tangle index", Metric.ValueType.PERCENT)
- .setDescription("Package tangle index")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Package tangle index")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String PACKAGE_TANGLES_KEY = "package_tangles";
public static final Metric PACKAGE_TANGLES = new Metric.Builder(PACKAGE_TANGLES_KEY, "File dependencies to cut", Metric.ValueType.INT)
- .setDescription("File dependencies to cut")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("File dependencies to cut")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String PACKAGE_FEEDBACK_EDGES_KEY = "package_feedback_edges";
public static final Metric PACKAGE_FEEDBACK_EDGES = new Metric.Builder(PACKAGE_FEEDBACK_EDGES_KEY, "Package dependencies to cut", Metric.ValueType.INT)
- .setDescription("Package dependencies to cut")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Package dependencies to cut")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String PACKAGE_EDGES_WEIGHT_KEY = "package_edges_weight";
public static final Metric PACKAGE_EDGES_WEIGHT = new Metric.Builder(PACKAGE_EDGES_WEIGHT_KEY, "Package edges weight", Metric.ValueType.INT)
- .setDescription("Package edges weight")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .create();
+ .setDescription("Package edges weight")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .create();
public static final String FILE_CYCLES_KEY = "file_cycles";
public static final Metric FILE_CYCLES = new Metric.Builder(FILE_CYCLES_KEY, "File cycles", Metric.ValueType.INT)
- .setDescription("File cycles")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("File cycles")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
public static final String FILE_TANGLE_INDEX_KEY = "file_tangle_index";
public static final Metric FILE_TANGLE_INDEX = new Metric.Builder(FILE_TANGLE_INDEX_KEY, "File tangle index", Metric.ValueType.PERCENT)
- .setDescription("File tangle index")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("File tangle index")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
public static final String FILE_TANGLES_KEY = "file_tangles";
public static final Metric FILE_TANGLES = new Metric.Builder(FILE_TANGLES_KEY, "File tangles", Metric.ValueType.INT)
- .setDescription("Files tangles")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("Files tangles")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
public static final String FILE_FEEDBACK_EDGES_KEY = "file_feedback_edges";
public static final Metric FILE_FEEDBACK_EDGES = new Metric.Builder(FILE_FEEDBACK_EDGES_KEY, "Suspect file dependencies", Metric.ValueType.INT)
- .setDescription("Suspect file dependencies")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("Suspect file dependencies")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
public static final String FILE_EDGES_WEIGHT_KEY = "file_edges_weight";
public static final Metric FILE_EDGES_WEIGHT = new Metric.Builder(FILE_EDGES_WEIGHT_KEY, "File edges weight", Metric.ValueType.INT)
- .setDescription("File edges weight")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("File edges weight")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
//--------------------------------------------------------------------------------------------------------------------
@@ -1092,34 +1185,34 @@ public final class CoreMetrics {
public static final String SCM_COMMITS_KEY = "commits";
public static final Metric SCM_COMMITS = new Metric.Builder(SCM_COMMITS_KEY, "Commits", Metric.ValueType.INT)
- .setDomain(DOMAIN_SCM)
- .create();
+ .setDomain(DOMAIN_SCM)
+ .create();
public static final String SCM_LAST_COMMIT_DATE_KEY = "last_commit_date";
public static final Metric SCM_LAST_COMMIT_DATE = new Metric.Builder(SCM_LAST_COMMIT_DATE_KEY, "Last commit", Metric.ValueType.STRING /* TODO: move to date */)
- .setDomain(DOMAIN_SCM)
- .create();
+ .setDomain(DOMAIN_SCM)
+ .create();
public static final String SCM_REVISION_KEY = "revision";
public static final Metric SCM_REVISION = new Metric.Builder(SCM_REVISION_KEY, "Revision", Metric.ValueType.STRING)
- .setDomain(DOMAIN_SCM)
- .setHidden(true)
- .create();
+ .setDomain(DOMAIN_SCM)
+ .setHidden(true)
+ .create();
public static final String SCM_AUTHORS_BY_LINE_KEY = "authors_by_line";
public static final Metric SCM_AUTHORS_BY_LINE = new Metric.Builder(SCM_AUTHORS_BY_LINE_KEY, "Authors by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_SCM)
- .create();
+ .setDomain(DOMAIN_SCM)
+ .create();
public static final String SCM_REVISIONS_BY_LINE_KEY = "revisions_by_line";
public static final Metric SCM_REVISIONS_BY_LINE = new Metric.Builder(SCM_REVISIONS_BY_LINE_KEY, "Revisions by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_SCM)
- .create();
+ .setDomain(DOMAIN_SCM)
+ .create();
public static final String SCM_LAST_COMMIT_DATETIMES_BY_LINE_KEY = "last_commit_datetimes_by_line";
public static final Metric SCM_LAST_COMMIT_DATETIMES_BY_LINE = new Metric.Builder(SCM_LAST_COMMIT_DATETIMES_BY_LINE_KEY, "Last commit dates by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_SCM)
- .create();
+ .setDomain(DOMAIN_SCM)
+ .create();
//--------------------------------------------------------------------------------------------------------------------
@@ -1129,25 +1222,25 @@ public final class CoreMetrics {
//--------------------------------------------------------------------------------------------------------------------
public static final String ALERT_STATUS_KEY = "alert_status";
public static final Metric ALERT_STATUS = new Metric.Builder(ALERT_STATUS_KEY, "Alert", Metric.ValueType.LEVEL)
- .setDescription("Alert")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_GENERAL)
- .create();
+ .setDescription("Alert")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_GENERAL)
+ .create();
public static final String PROFILE_KEY = "profile";
public static final Metric PROFILE = new Metric.Builder(PROFILE_KEY, "Profile", Metric.ValueType.DATA)
- .setDescription("Selected quality profile")
- .setDomain(DOMAIN_GENERAL)
- .create();
+ .setDescription("Selected quality profile")
+ .setDomain(DOMAIN_GENERAL)
+ .create();
public static final String PROFILE_VERSION_KEY = "profile_version";
public static final Metric PROFILE_VERSION = new Metric.Builder(PROFILE_VERSION_KEY, "Profile version", Metric.ValueType.INT)
- .setDescription("Selected quality profile version")
- .setQualitative(false)
- .setDomain(DOMAIN_GENERAL)
- .create();
+ .setDescription("Selected quality profile version")
+ .setQualitative(false)
+ .setDomain(DOMAIN_GENERAL)
+ .create();
public static List<Metric> metrics = Lists.newLinkedList();
diff --git a/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java b/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java
index a68cbc86c19..7eac2d7f5f5 100644
--- a/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java
+++ b/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java
@@ -28,7 +28,7 @@ import org.sonar.api.web.*;
*/
public final class DefaultPages {
- private static final View[] PAGES = { new SourceTab(), new CoverageTab(), new ViolationsTab(), new DuplicationsTab() };
+ private static final View[] PAGES = {new SourceTab(), new CoverageTab(), new ViolationsTab(), new DuplicationsTab()};
private DefaultPages() {
}
@@ -60,10 +60,16 @@ public final class DefaultPages {
@NavigationSection(NavigationSection.RESOURCE_TAB)
@ResourceQualifier({Qualifiers.FILE, Qualifiers.CLASS})
- @DefaultTab(metrics = {CoreMetrics.COVERAGE_KEY, CoreMetrics.LINES_TO_COVER_KEY, CoreMetrics.UNCOVERED_LINES_KEY, CoreMetrics.LINE_COVERAGE_KEY,
- CoreMetrics.CONDITIONS_TO_COVER_KEY, CoreMetrics.UNCOVERED_CONDITIONS_KEY, CoreMetrics.BRANCH_COVERAGE_KEY,
- CoreMetrics.NEW_COVERAGE_KEY, CoreMetrics.NEW_UNCOVERED_LINES_KEY, CoreMetrics.NEW_LINE_COVERAGE_KEY,
- CoreMetrics.NEW_LINES_TO_COVER_KEY, CoreMetrics.NEW_BRANCH_COVERAGE_KEY, CoreMetrics.NEW_CONDITIONS_TO_COVER_KEY, CoreMetrics.NEW_UNCOVERED_CONDITIONS_KEY
+ @DefaultTab(metrics = {
+ /* unit tests */
+ CoreMetrics.COVERAGE_KEY, CoreMetrics.LINES_TO_COVER_KEY, CoreMetrics.UNCOVERED_LINES_KEY, CoreMetrics.LINE_COVERAGE_KEY,
+ CoreMetrics.CONDITIONS_TO_COVER_KEY, CoreMetrics.UNCOVERED_CONDITIONS_KEY, CoreMetrics.BRANCH_COVERAGE_KEY,
+ CoreMetrics.NEW_COVERAGE_KEY, CoreMetrics.NEW_UNCOVERED_LINES_KEY, CoreMetrics.NEW_LINE_COVERAGE_KEY,
+ CoreMetrics.NEW_LINES_TO_COVER_KEY, CoreMetrics.NEW_BRANCH_COVERAGE_KEY, CoreMetrics.NEW_CONDITIONS_TO_COVER_KEY, CoreMetrics.NEW_UNCOVERED_CONDITIONS_KEY,
+
+ /* integration tests */
+ CoreMetrics.IT_COVERAGE_KEY, CoreMetrics.IT_LINES_TO_COVER_KEY, CoreMetrics.IT_UNCOVERED_LINES_KEY, CoreMetrics.IT_LINE_COVERAGE_KEY,
+ CoreMetrics.IT_CONDITIONS_TO_COVER_KEY, CoreMetrics.IT_UNCOVERED_CONDITIONS_KEY, CoreMetrics.IT_BRANCH_COVERAGE_KEY
})
@UserRole(UserRole.CODEVIEWER)
private static final class CoverageTab implements RubyRailsPage {
@@ -83,9 +89,9 @@ public final class DefaultPages {
@NavigationSection(NavigationSection.RESOURCE_TAB)
@DefaultTab(metrics = {CoreMetrics.VIOLATIONS_DENSITY_KEY, CoreMetrics.WEIGHTED_VIOLATIONS_KEY, CoreMetrics.VIOLATIONS_KEY, CoreMetrics.BLOCKER_VIOLATIONS_KEY,
- CoreMetrics.CRITICAL_VIOLATIONS_KEY, CoreMetrics.MAJOR_VIOLATIONS_KEY, CoreMetrics.MINOR_VIOLATIONS_KEY, CoreMetrics.INFO_VIOLATIONS_KEY,
- CoreMetrics.NEW_VIOLATIONS_KEY, CoreMetrics.NEW_BLOCKER_VIOLATIONS_KEY, CoreMetrics.NEW_CRITICAL_VIOLATIONS_KEY, CoreMetrics.NEW_MAJOR_VIOLATIONS_KEY,
- CoreMetrics.NEW_MINOR_VIOLATIONS_KEY, CoreMetrics.NEW_INFO_VIOLATIONS_KEY})
+ CoreMetrics.CRITICAL_VIOLATIONS_KEY, CoreMetrics.MAJOR_VIOLATIONS_KEY, CoreMetrics.MINOR_VIOLATIONS_KEY, CoreMetrics.INFO_VIOLATIONS_KEY,
+ CoreMetrics.NEW_VIOLATIONS_KEY, CoreMetrics.NEW_BLOCKER_VIOLATIONS_KEY, CoreMetrics.NEW_CRITICAL_VIOLATIONS_KEY, CoreMetrics.NEW_MAJOR_VIOLATIONS_KEY,
+ CoreMetrics.NEW_MINOR_VIOLATIONS_KEY, CoreMetrics.NEW_INFO_VIOLATIONS_KEY})
@ResourceQualifier({Qualifiers.VIEW, Qualifiers.SUBVIEW, Qualifiers.PROJECT, Qualifiers.MODULE, Qualifiers.PACKAGE, Qualifiers.DIRECTORY, Qualifiers.FILE, Qualifiers.CLASS})
/* all exept unit tests...*/
@UserRole(UserRole.CODEVIEWER)
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
index 339b8a0854b..2b753e44d7a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
@@ -131,53 +131,58 @@ class ResourceController < ApplicationController
def render_coverage
load_sources()
- @display_coverage=true
- @expandable=(@lines!=nil)
+ @display_coverage = true
+ @display_it_coverage = (! @snapshot.measure('it_coverage').nil?)
+ @expandable = (@lines!=nil)
if @lines
- @hits_by_line=load_distribution('coverage_line_hits_data')
- @conditions_by_line=load_distribution('conditions_by_line')
- @covered_conditions_by_line=load_distribution('covered_conditions_by_line')
+ metric = Metric.by_key(params[:coverage_filter]||params[:metric])
+ @coverage_filter = (metric ? metric.key : 'coverage')
+ it_prefix = (@coverage_filter.start_with?('it_') ? 'it_' : '')
+
+ @hits_by_line = load_distribution("#{it_prefix}coverage_line_hits_data")
+ @conditions_by_line = load_distribution("#{it_prefix}conditions_by_line")
+ @covered_conditions_by_line = load_distribution("#{it_prefix}covered_conditions_by_line")
@hits_by_line.each_pair do |line_id,hits|
- line=@lines[line_id-1]
+ line = @lines[line_id-1]
if line
- line.hits=hits.to_i
- line.conditions=@conditions_by_line[line_id].to_i
- line.covered_conditions=@covered_conditions_by_line[line_id].to_i
+ line.hits = hits.to_i
+ line.conditions = @conditions_by_line[line_id].to_i
+ line.covered_conditions = @covered_conditions_by_line[line_id].to_i
end
end
- if @snapshot.measure('conditions_by_line').nil?
+ if @snapshot.measure("#{it_prefix}conditions_by_line").nil?
# TODO remove this code when branch_coverage_hits_data is fully removed from CoreMetrics
- deprecated_branches_by_line=load_distribution('branch_coverage_hits_data')
+ deprecated_branches_by_line = load_distribution("#{it_prefix}branch_coverage_hits_data")
deprecated_branches_by_line.each_pair do |line_id,label|
- line=@lines[line_id-1]
+ line = @lines[line_id-1]
if line
- line.deprecated_conditions_label=label
+ line.deprecated_conditions_label = label
end
end
end
- to=(@period && @snapshot.period_datetime(@period) ? Java::JavaUtil::Date.new(@snapshot.period_datetime(@period).to_f * 1000) : nil)
- metric=Metric.by_key(params[:coverage_filter]||params[:metric])
- @coverage_filter=(metric ? metric.key : 'coverage')
- @filtered=true
+ to = (@period && @snapshot.period_datetime(@period) ? Java::JavaUtil::Date.new(@snapshot.period_datetime(@period).to_f * 1000) : nil)
+ @filtered = true
if ('lines_to_cover'==@coverage_filter || 'coverage'==@coverage_filter || 'line_coverage'==@coverage_filter ||
- 'new_lines_to_cover'==@coverage_filter || 'new_coverage'==@coverage_filter || 'new_line_coverage'==@coverage_filter)
- @coverage_filter='lines_to_cover'
+ 'new_lines_to_cover'==@coverage_filter || 'new_coverage'==@coverage_filter || 'new_line_coverage'==@coverage_filter ||
+ 'it_lines_to_cover'==@coverage_filter || 'it_coverage'==@coverage_filter || 'it_line_coverage'==@coverage_filter)
+ @coverage_filter = "#{it_prefix}lines_to_cover"
filter_lines{|line| line.hits && line.after(to)}
- elsif 'uncovered_lines'==@coverage_filter || 'new_uncovered_lines'==@coverage_filter
- @coverage_filter='uncovered_lines'
+ elsif 'uncovered_lines'==@coverage_filter || 'new_uncovered_lines'==@coverage_filter || 'it_uncovered_lines'==@coverage_filter
+ @coverage_filter = "#{it_prefix}uncovered_lines"
filter_lines{|line| line.hits && line.hits==0 && line.after(to)}
elsif 'conditions_to_cover'==@coverage_filter || 'branch_coverage'==@coverage_filter ||
- 'new_conditions_to_cover'==@coverage_filter || 'new_branch_coverage'==@coverage_filter
- @coverage_filter='conditions_to_cover'
+ 'new_conditions_to_cover'==@coverage_filter || 'new_branch_coverage'==@coverage_filter ||
+ 'it_conditions_to_cover'==@coverage_filter || 'it_branch_coverage'==@coverage_filter
+ @coverage_filter="#{it_prefix}conditions_to_cover"
filter_lines{|line| line.conditions && line.conditions>0 && line.after(to)}
- elsif 'uncovered_conditions'==@coverage_filter || 'new_uncovered_conditions'==@coverage_filter
- @coverage_filter='uncovered_conditions'
+ elsif 'uncovered_conditions'==@coverage_filter || 'new_uncovered_conditions'==@coverage_filter || 'it_uncovered_conditions'==@coverage_filter
+ @coverage_filter="#{it_prefix}uncovered_conditions"
filter_lines{|line| line.conditions && line.covered_conditions && line.covered_conditions<line.conditions && line.after(to)}
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb
index 024f82c56df..8212fe13a1c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb
@@ -68,19 +68,25 @@ class Metric < ActiveRecord::Base
}.compact.uniq.sort
end
- def self.i18n_domain_for(to_translate)
- return nil if to_translate.nil?
+ # Localized domain name
+ def self.domain_for(domain_key)
+ return nil if domain_key.nil?
- localeMap = Metric.i18n_domain_cache[to_translate]
+ localeMap = Metric.i18n_domain_cache[domain_key]
locale = I18n.locale
- return localeMap[locale] if not localeMap.nil? and localeMap.has_key?(locale)
+ return localeMap[locale] if localeMap && localeMap.has_key?(locale)
- i18n_key = 'metric_domain.' + to_translate
- result = Api::Utils.message(i18n_key, :default => to_translate)
+ i18n_key = 'metric_domain.' + domain_key
+ result = Api::Utils.message(i18n_key, :default => domain_key)
localeMap[locale] = result if localeMap
result
end
+
+ def self.name_for(metric_key)
+ m=by_key(metric_key)
+ m ? m.short_name : nil
+ end
def key
name
@@ -89,7 +95,7 @@ class Metric < ActiveRecord::Base
def domain(translate=true)
default_string = read_attribute(:domain)
return default_string unless translate
- Metric.i18n_domain_for(default_string)
+ Metric.domain_for(default_string)
end
def domain=(value)
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb
index d3fc617b3c1..abcf4e4c397 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb
@@ -8,7 +8,7 @@
<td class="sep"> </td>
<% if m=measure('new_line_coverage') %>
- <td class="name"><%= message('metric.line_coverage.name') -%>:</td>
+ <td class="name"><%= Metric.name_for('line_coverage') -%>:</td>
<td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%></td>
<% else %>
<td colspan="2"></td>
@@ -16,7 +16,7 @@
<td class="sep"> </td>
<% if m=measure('new_branch_coverage') %>
- <td class="name"><%= message('metric.branch_coverage.name') -%>:</td>
+ <td class="name"><%= Metric.name_for('branch_coverage') -%>:</td>
<td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%></td>
<% else %>
<td colspan="2"></td>
@@ -25,7 +25,7 @@
<tr>
<td class="sep"> </td>
<% if m=measure('new_uncovered_lines') %>
- <td class="name"><%= message('metric.uncovered_lines.name') -%>:</td>
+ <td class="name"><%= Metric.name_for('uncovered_lines') -%>:</td>
<td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%>/<%= format_variation('new_lines_to_cover', :period => @period, :style => 'none') -%></td>
<% else %>
<td colspan="2"></td>
@@ -33,7 +33,7 @@
<td class="sep"> </td>
<% if m=measure('new_uncovered_conditions') %>
- <td class="name"><%= message('metric.uncovered_conditions.name') -%>: </td>
+ <td class="name"><%= Metric.name_for('uncovered_conditions') -%>: </td>
<td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%>/<%= format_variation('new_conditions_to_cover', :period => @period, :style => 'none') -%></td>
<% else %>
<td colspan="2"></td>
@@ -42,19 +42,40 @@
</table>
<% else %>
<table>
+ <% if @display_it_coverage %>
+ <tr>
+ <td colspan="8"><%= message('coverage_tab.unit_tests') -%></td>
+ <td colspan="7"><%= message('coverage_tab.integration_tests') -%></td>
+ </tr>
+ <% end %>
<tr>
<td class="big" rowspan="2"><%= format_measure('coverage', :default => '-') -%></td>
<td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('line_coverage'), :title => message('metric.line_coverage.name')} -%>
+ <%= render :partial => 'measure', :locals => {:measure => measure('line_coverage'), :title => Metric.name_for('line_coverage')} -%>
+ <td class="sep"> </td>
+ <%= render :partial => 'measure', :locals => {:measure => measure('branch_coverage'), :title => Metric.name_for('branch_coverage')} -%>
+ <td class="sep"> </td>
+ <% if @display_it_coverage %>
+ <td class="big" rowspan="2"><%= format_measure('it_coverage', :default => '-') -%></td>
<td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('branch_coverage'), :title => message('metric.branch_coverage.name')} -%>
+ <%= render :partial => 'measure', :locals => {:measure => measure('it_line_coverage'), :title => Metric.name_for('it_line_coverage')} -%>
+ <td class="sep"> </td>
+ <%= render :partial => 'measure', :locals => {:measure => measure('it_branch_coverage'), :title => Metric.name_for('it_branch_coverage')} -%>
+ <% end %>
</tr>
<tr>
<td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_lines'), :title => message('metric.uncovered_lines.name'), :ratio => measure('lines_to_cover')} -%>
+ <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_lines'), :title => Metric.name_for('uncovered_lines'), :ratio => measure('lines_to_cover')} -%>
<td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_conditions'), :title => message('metric.uncovered_conditions.name'), :ratio => measure('conditions_to_cover')} -%>
+ <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_conditions'), :title => Metric.name_for('uncovered_conditions'), :ratio => measure('conditions_to_cover')} -%>
+ <td class="sep"> </td>
+ <% if @display_it_coverage %>
+ <td class="sep"> </td>
+ <%= render :partial => 'measure', :locals => {:measure => measure('it_uncovered_lines'), :title => Metric.name_for('it_uncovered_lines'), :ratio => measure('it_lines_to_cover')} -%>
+ <td class="sep"> </td>
+ <%= render :partial => 'measure', :locals => {:measure => measure('it_uncovered_conditions'), :title => Metric.name_for('it_uncovered_conditions'), :ratio => measure('it_conditions_to_cover')} -%>
+ <% end %>
</tr>
</table>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
index df02860d42c..d625f26280d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
@@ -67,10 +67,20 @@
<% if @display_coverage %>
<td class="<%= 'first' if first -%>">
<select id="coverage_filter" name="coverage_filter" onchange="applyOptions()">
- <option value="lines_to_cover" <%= 'selected' if @coverage_filter=='lines_to_cover' -%>><%= message('metric.lines_to_cover.name') -%></option>
- <option value="uncovered_lines" <%= 'selected' if @coverage_filter=='uncovered_lines' -%>><%= message('metric.uncovered_lines.name') -%></option>
- <option value="conditions_to_cover" <%= 'selected' if @coverage_filter=='conditions_to_cover' -%>><%= message('metric.conditions_to_cover.name') -%></option>
- <option value="uncovered_conditions" <%= 'selected' if @coverage_filter=='uncovered_conditions' -%>><%= message('metric.uncovered_conditions.name') -%></option>
+ <optgroup label="<%= h message('coverage_tab.unit_tests') -%>">
+ <option value="lines_to_cover" <%= 'selected' if @coverage_filter=='lines_to_cover' -%>><%= Metric.name_for('lines_to_cover') -%></option>
+ <option value="uncovered_lines" <%= 'selected' if @coverage_filter=='uncovered_lines' -%>><%= Metric.name_for('uncovered_lines') -%></option>
+ <option value="conditions_to_cover" <%= 'selected' if @coverage_filter=='conditions_to_cover' -%>><%= Metric.name_for('conditions_to_cover') -%></option>
+ <option value="uncovered_conditions" <%= 'selected' if @coverage_filter=='uncovered_conditions' -%>><%= Metric.name_for('uncovered_conditions') -%></option>
+ </optgroup>
+ <% if @display_it_coverage %>
+ <optgroup label="<%= h message('coverage_tab.integration_tests') -%>">
+ <option value="it_lines_to_cover" <%= 'selected' if @coverage_filter=='it_lines_to_cover' -%>><%= Metric.name_for('it_lines_to_cover') -%></option>
+ <option value="it_uncovered_lines" <%= 'selected' if @coverage_filter=='it_uncovered_lines' -%>><%= Metric.name_for('it_uncovered_lines') -%></option>
+ <option value="it_conditions_to_cover" <%= 'selected' if @coverage_filter=='it_conditions_to_cover' -%>><%= Metric.name_for('it_conditions_to_cover') -%></option>
+ <option value="it_uncovered_conditions" <%= 'selected' if @coverage_filter=='it_uncovered_conditions' -%>><%= Metric.name_for('it_uncovered_conditions') -%></option>
+ </optgroup>
+ <% end %>
</select>
</td>
<% first=false
diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css
index c7cf810ded2..2a54141730e 100644
--- a/sonar-server/src/main/webapp/stylesheets/style.css
+++ b/sonar-server/src/main/webapp/stylesheets/style.css
@@ -902,11 +902,11 @@ span.rulename a:hover {
padding-right: 7px;
}
.tab_header td.name {
- font-weight: bold;
text-align: left;
white-space: nowrap;
}
.tab_header td.value {
+ font-weight: bold;
text-align: right;
white-space: nowrap;
}