diff options
-rw-r--r-- | plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CpdTokenizerSensor.java | 2 | ||||
-rw-r--r-- | sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CpdTokenizerSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CpdTokenizerSensor.java index 568003d9d89..13106de2bee 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CpdTokenizerSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CpdTokenizerSensor.java @@ -74,7 +74,7 @@ public class CpdTokenizerSensor implements Sensor { public void describe(SensorDescriptor descriptor) { descriptor .name("Xoo Cpd Tokenizer Sensor") - .requireProperty(ENABLE_PROP) + .onlyWhenConfiguration(conf -> conf.hasKey(ENABLE_PROP) || conf.hasKey(ENABLE_PROP + ".old")) .onlyOnLanguages(Xoo.KEY); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java index f75bd498bc3..31d259acd11 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java @@ -53,7 +53,7 @@ public class CpdMediumTest { @Parameters(name = "new api: {0}") public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { - {true}, {false} + {true, false}, {true, true}, {false, false} }); } @@ -79,9 +79,11 @@ public class CpdMediumTest { private ImmutableMap.Builder<String, String> builder; private boolean useNewSensorApi; + private boolean useDeprecatedProperty; - public CpdMediumTest(boolean useNewSensorApi) { + public CpdMediumTest(boolean useNewSensorApi, boolean useDeprecatedProperty) { this.useNewSensorApi = useNewSensorApi; + this.useDeprecatedProperty = useDeprecatedProperty; } @Before @@ -99,7 +101,7 @@ public class CpdMediumTest { .put("sonar.projectVersion", "1.0-SNAPSHOT") .put("sonar.projectDescription", "Description of Foo Project"); if (useNewSensorApi) { - builder.put(CpdTokenizerSensor.ENABLE_PROP, "true"); + builder.put(CpdTokenizerSensor.ENABLE_PROP + (useDeprecatedProperty ? ".deprecated" : ""), "true"); } } |