diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2021-05-11 08:37:53 -0500 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-05-18 20:08:04 +0000 |
commit | 18bdf671d1ec956b772a1cd763e373f1236aab0a (patch) | |
tree | 880dbaaa89849292ff77a005ebc22e34ab4e2ccd /plugins | |
parent | ce38ba902f333221640eb8eab3413cf0ef2762ee (diff) | |
download | sonarqube-18bdf671d1ec956b772a1cd763e373f1236aab0a.tar.gz sonarqube-18bdf671d1ec956b772a1cd763e373f1236aab0a.zip |
SONAR-14794 Optimize ITs: Only run Xoo's NoSonarSensor if property is defined
Diffstat (limited to 'plugins')
-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 |