diff options
-rw-r--r-- | plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/NoSonarSensor.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/NoSonarSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/NoSonarSensor.java index 3e81208efae..e57a3378599 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/NoSonarSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/NoSonarSensor.java @@ -34,8 +34,8 @@ import org.sonar.xoo.Xoo; @Phase(name = Phase.Name.PRE) public class NoSonarSensor implements Sensor { - - private NoSonarFilter noSonarFilter; + private static final String NO_SONAR_SENSOR_ACTIVATE = "sonar.nosonarsensor.activate"; + private final NoSonarFilter noSonarFilter; public NoSonarSensor(NoSonarFilter noSonarFilter) { this.noSonarFilter = noSonarFilter; @@ -44,7 +44,8 @@ public class NoSonarSensor implements Sensor { @Override public void describe(SensorDescriptor descriptor) { descriptor - .onlyOnLanguage(Xoo.KEY); + .onlyOnLanguage(Xoo.KEY) + .onlyWhenConfiguration(c -> c.getBoolean(NO_SONAR_SENSOR_ACTIVATE).orElse(false)); } @Override |