summaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2016-08-29 15:34:48 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2016-08-29 15:34:48 +0200
commit0fa7bac665d9c3a29af5db01a445e71d7af23ca5 (patch)
tree52449fad607ae5799033994cb262608c83282cd4 /sonar-plugin-api
parent971c84d19547548ca70251d6131018ed0d083179 (diff)
downloadsonarqube-0fa7bac665d9c3a29af5db01a445e71d7af23ca5.tar.gz
sonarqube-0fa7bac665d9c3a29af5db01a445e71d7af23ca5.zip
SONAR-5813 Fully drop support of "sonar.cpd.xxx.skip" properties
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java21
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokensTest.java32
3 files changed, 4 insertions, 56 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
index 76d5ae24ca5..3960bb7054b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
@@ -226,13 +226,6 @@ public interface CoreProperties {
String CPD_PLUGIN = "cpd";
/**
- * @deprecated in 5.0
- * @see <a href="https://jira.sonarsource.com/browse/SONAR-5339">SONAR-5339</a>
- */
- @Deprecated
- String CPD_SKIP_PROPERTY = "sonar.cpd.skip";
-
- /**
* @since 2.11
*/
String CPD_CROSS_PROJECT = "sonar.cpd.cross_project";
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java
index 20db6a92e5e..16d8be19e08 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokens.java
@@ -54,28 +54,15 @@ public class DefaultCpdTokens extends DefaultStorable implements NewCpdTokens {
public DefaultCpdTokens onFile(InputFile inputFile) {
Preconditions.checkNotNull(inputFile, "file can't be null");
this.inputFile = (DefaultInputFile) inputFile;
- String language = inputFile.language();
- if (language != null && isSkipped(language)) {
- this.excluded = true;
- } else {
- String[] cpdExclusions = settings.getStringArray(CoreProperties.CPD_EXCLUSIONS);
- for (PathPattern cpdExclusion : PathPattern.create(cpdExclusions)) {
- if (cpdExclusion.match(inputFile)) {
- this.excluded = true;
- }
+ String[] cpdExclusions = settings.getStringArray(CoreProperties.CPD_EXCLUSIONS);
+ for (PathPattern cpdExclusion : PathPattern.create(cpdExclusions)) {
+ if (cpdExclusion.match(inputFile)) {
+ this.excluded = true;
}
}
return this;
}
- boolean isSkipped(String language) {
- String key = "sonar.cpd." + language + ".skip";
- if (settings.hasKey(key)) {
- return settings.getBoolean(key);
- }
- return settings.getBoolean(CoreProperties.CPD_SKIP_PROPERTY);
- }
-
public InputFile inputFile() {
return inputFile;
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokensTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokensTest.java
index 94494b95923..96310b70977 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokensTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/cpd/internal/DefaultCpdTokensTest.java
@@ -83,38 +83,6 @@ public class DefaultCpdTokensTest {
}
@Test
- public void handle_exclusions_by_language() {
- SensorStorage sensorStorage = mock(SensorStorage.class);
- Settings settings = new Settings();
- settings.setProperty("sonar.cpd.java.skip", "true");
- DefaultCpdTokens tokens = new DefaultCpdTokens(settings, sensorStorage)
- .onFile(INPUT_FILE)
- .addToken(INPUT_FILE.newRange(1, 2, 1, 5), "foo");
-
- tokens.save();
-
- verifyZeroInteractions(sensorStorage);
-
- assertThat(tokens.getTokenLines()).isEmpty();
- }
-
- @Test
- public void handle_exclusions() {
- SensorStorage sensorStorage = mock(SensorStorage.class);
- Settings settings = new Settings();
- settings.setProperty("sonar.cpd.skip", "true");
- DefaultCpdTokens tokens = new DefaultCpdTokens(settings, sensorStorage)
- .onFile(INPUT_FILE)
- .addToken(INPUT_FILE.newRange(1, 2, 1, 5), "foo");
-
- tokens.save();
-
- verifyZeroInteractions(sensorStorage);
-
- assertThat(tokens.getTokenLines()).isEmpty();
- }
-
- @Test
public void save_many_tokens() {
SensorStorage sensorStorage = mock(SensorStorage.class);
DefaultCpdTokens tokens = new DefaultCpdTokens(new Settings(), sensorStorage)