diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2016-10-12 16:11:42 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2016-10-18 16:00:26 +0200 |
commit | c9387788b44e4f151d2f2c72d33cbb4409e1a03e (patch) | |
tree | 9a18dbb22fd57ffe9a39bf59a719155ce59e5cb3 /sonar-plugin-api | |
parent | c7b8a0fc8240e0156ba34419a2805e0df652761e (diff) | |
download | sonarqube-c9387788b44e4f151d2f2c72d33cbb4409e1a03e.tar.gz sonarqube-c9387788b44e4f151d2f2c72d33cbb4409e1a03e.zip |
SONAR-8281 Change coverage API to accept unlimited reports/deprecate coverage type
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java | 3 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java | 16 |
2 files changed, 16 insertions, 3 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java index 6597c3bcc01..019624c0dbb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java @@ -48,7 +48,10 @@ import static org.sonar.api.measures.CoreMetrics.UNCOVERED_LINES; /** * Different coverage categories. * @since 5.2 + * + * @deprecated since 6.2 SonarQube merge all coverage reports and don't keep track of different test category */ +@Deprecated public enum CoverageType { UNIT(LINES_TO_COVER, UNCOVERED_LINES, COVERAGE_LINE_HITS_DATA, CONDITIONS_TO_COVER, UNCOVERED_CONDITIONS, COVERED_CONDITIONS_BY_LINE, CONDITIONS_BY_LINE), diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java index 63877cbe34d..81dce497138 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java @@ -22,13 +22,12 @@ package org.sonar.api.batch.sensor.coverage; import org.sonar.api.batch.fs.InputFile; /** - * This builder is used to define code coverage by tests of a given type (UT/IT/Overall) on files. + * This class is used to report code coverage on files. * * Example: * * <pre> * sensorContext.newCoverage().onFile(file) - .ofType(UNIT) .lineHits(1, 2) .lineHits(2, 5) .lineHits(3, 0) @@ -39,6 +38,13 @@ import org.sonar.api.batch.fs.InputFile; .save(); * * </pre> + * + * Since 6.2 you can save several reports for the same file and reports will be merged using the following "additive" strategy: + * <ul> + * <li>Line hits are cumulated</li> + * <li>We keep the max for condition coverage. Examples: 2/4 + 2/4 = 2/4, 2/4 + 3/4 = 3/4</li> + * </ul> + * * @since 5.2 */ public interface NewCoverage { @@ -48,6 +54,10 @@ public interface NewCoverage { */ NewCoverage onFile(InputFile inputFile); + /** + * @deprecated since 6.2 SonarQube merge all coverage reports and don't keep track of different test category + */ + @Deprecated NewCoverage ofType(CoverageType type); /** @@ -66,7 +76,7 @@ public interface NewCoverage { NewCoverage conditions(int line, int conditions, int coveredConditions); /** - * Call this method only once when your are done with defining coverage of the file. + * Call this method to save the coverage report for the given file. Data will be merged with existing coverage information. */ void save(); } |