diff options
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar/batch/scan2/AnalyzerOptimizer.java')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/scan2/AnalyzerOptimizer.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/AnalyzerOptimizer.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/AnalyzerOptimizer.java index fb461854c69..4ae3ddfce09 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan2/AnalyzerOptimizer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/AnalyzerOptimizer.java @@ -19,16 +19,19 @@ */ package org.sonar.batch.scan2; -import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.BatchComponent; import org.sonar.api.batch.fs.FilePredicate; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.rule.ActiveRules; +import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; public class AnalyzerOptimizer implements BatchComponent { + private static final Logger LOG = LoggerFactory.getLogger(AnalyzerOptimizer.class); + private final FileSystem fs; private final ActiveRules activeRules; @@ -41,10 +44,15 @@ public class AnalyzerOptimizer implements BatchComponent { * Decide if the given Analyzer should be executed. */ public boolean shouldExecute(DefaultSensorDescriptor descriptor) { - // FS Conditions - boolean fsCondition = fsCondition(descriptor); - boolean activeRulesCondition = activeRulesCondition(descriptor); - return fsCondition && activeRulesCondition; + if (!fsCondition(descriptor)) { + LOG.debug("'{}' skipped because there is no related file in current project", descriptor.name()); + return false; + } + if (!activeRulesCondition(descriptor)) { + LOG.debug("'{}' skipped because there is no related rule activated in the quality profile", descriptor.name()); + return false; + } + return true; } private boolean activeRulesCondition(DefaultSensorDescriptor descriptor) { |