diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-09-02 17:25:02 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-09-02 17:25:37 +0200 |
commit | 39f52452ee8a3d414dd9f2a4dee3dfffdb082c1d (patch) | |
tree | 7e4236198b7fc23ba660c3059ec3ae3ca9e21435 /plugins | |
parent | 17c62b8bdda7f882626e0cbec7d5338deb49617d (diff) | |
download | sonarqube-39f52452ee8a3d414dd9f2a4dee3dfffdb082c1d.tar.gz sonarqube-39f52452ee8a3d414dd9f2a4dee3dfffdb082c1d.zip |
SONAR-5576 Display coverage exclusions in logs
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CoverageMeasurementFilter.java | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CoverageMeasurementFilter.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CoverageMeasurementFilter.java index eeda60396a9..e236c6298ed 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CoverageMeasurementFilter.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CoverageMeasurementFilter.java @@ -23,6 +23,9 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.ImmutableSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sonar.api.CoreProperties; import org.sonar.api.config.Settings; import org.sonar.api.measures.Measure; import org.sonar.api.measures.Metric; @@ -35,14 +38,16 @@ import java.util.Iterator; public class CoverageMeasurementFilter implements MeasurementFilter { + private static final Logger LOG = LoggerFactory.getLogger(CoverageMeasurementFilter.class); + private final Settings settings; private final ImmutableSet<Metric> coverageMetrics; private Collection<WildcardPattern> resourcePatterns; public CoverageMeasurementFilter(Settings settings, - CoverageDecorator coverageDecorator, - LineCoverageDecorator lineCoverageDecorator, - BranchCoverageDecorator branchCoverageDecorator) { + CoverageDecorator coverageDecorator, + LineCoverageDecorator lineCoverageDecorator, + BranchCoverageDecorator branchCoverageDecorator) { this.settings = settings; this.coverageMetrics = ImmutableSet.<Metric>builder() .addAll(coverageDecorator.generatedMetrics()) @@ -81,9 +86,19 @@ public class CoverageMeasurementFilter implements MeasurementFilter { @VisibleForTesting final void initPatterns() { Builder<WildcardPattern> builder = ImmutableList.builder(); - for (String pattern : settings.getStringArray("sonar.coverage.exclusions")) { + for (String pattern : settings.getStringArray(CoreProperties.PROJECT_COVERAGE_EXCLUSIONS_PROPERTY)) { builder.add(WildcardPattern.create(pattern)); } resourcePatterns = builder.build(); + log("Excluded sources for coverage: ", resourcePatterns); + } + + private void log(String title, Collection<WildcardPattern> patterns) { + if (!patterns.isEmpty()) { + LOG.info(title); + for (WildcardPattern pattern : patterns) { + LOG.info(" " + pattern); + } + } } } |