aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorssjenka <ssjenka@ops-slave-centos7-1.internal.sonarsource.com>2016-07-22 08:02:24 +0200
committerssjenka <ssjenka@ops-slave-centos7-1.internal.sonarsource.com>2016-07-22 08:02:24 +0200
commit5e769422d2704ba6a22321d3bccef2d23da9d7f9 (patch)
treef668759609e077f55117560234220d9b6ea35561 /plugins
parent1bb0e1cfd1aa5f2de1d20d6d9a10af3803dde057 (diff)
parent5b6b0ccb4d3ee740c6864035c7328a2ed67e37d8 (diff)
downloadsonarqube-5e769422d2704ba6a22321d3bccef2d23da9d7f9.tar.gz
sonarqube-5e769422d2704ba6a22321d3bccef2d23da9d7f9.zip
Automatic merge from branch-6.0
* origin/branch-6.0: fix profile overflow on project overview page SONAR-7912 Highlight releasability rating in measure page of a view Update Xoo plugin to test Settings default values SONAR-7751 Missing @SonarLintSide on some extensions
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo.java15
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java9
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java4
3 files changed, 21 insertions, 7 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo.java
index ab9a6547de3..0f4c272b1ba 100644
--- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo.java
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo.java
@@ -19,17 +19,22 @@
*/
package org.sonar.xoo;
+import java.util.Arrays;
+import org.sonar.api.config.Settings;
import org.sonar.api.resources.Language;
public class Xoo implements Language {
public static final String KEY = "xoo";
public static final String NAME = "Xoo";
- public static final String FILE_SUFFIX = ".xoo";
+ public static final String FILE_SUFFIXES_KEY = "sonar.xoo.file.suffixes";
+ public static final String DEFAULT_FILE_SUFFIXES = ".xoo";
- private static final String[] XOO_SUFFIXES = {
- FILE_SUFFIX
- };
+ private final Settings settings;
+
+ public Xoo(Settings settings) {
+ this.settings = settings;
+ }
@Override
public String getKey() {
@@ -43,6 +48,6 @@ public class Xoo implements Language {
@Override
public String[] getFileSuffixes() {
- return XOO_SUFFIXES;
+ return Arrays.stream(settings.getStringArray(FILE_SUFFIXES_KEY)).filter(s -> s != null && !s.trim().isEmpty()).toArray(String[]::new);
}
}
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java
index 9b443628856..7cc594aa958 100644
--- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java
@@ -21,6 +21,8 @@ package org.sonar.xoo;
import org.sonar.api.Plugin;
import org.sonar.api.SonarProduct;
+import org.sonar.api.config.PropertyDefinition;
+import org.sonar.api.resources.Qualifiers;
import org.sonar.xoo.coverage.ItCoverageSensor;
import org.sonar.xoo.coverage.OverallCoverageSensor;
import org.sonar.xoo.coverage.UtCoverageSensor;
@@ -73,6 +75,13 @@ public class XooPlugin implements Plugin {
@Override
public void define(Context context) {
context.addExtensions(
+ PropertyDefinition.builder(Xoo.FILE_SUFFIXES_KEY)
+ .defaultValue(Xoo.DEFAULT_FILE_SUFFIXES)
+ .name("File suffixes")
+ .description("Comma-separated list of suffixes for files to analyze. To not filter, leave the list empty.")
+ .subCategory("General")
+ .onQualifiers(Qualifiers.PROJECT)
+ .build(),
Xoo.class,
Xoo2.class,
XooRulesDefinition.class,
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java
index 6a0507af8d1..3d72a69bd42 100644
--- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java
+++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java
@@ -35,10 +35,10 @@ public class XooPluginTest {
public void provide_extensions_for_5_5() {
Plugin.Context context = new Plugin.Context(new SonarRuntime(Version.parse("5.5"), SonarProduct.SONARQUBE, SonarQubeSide.SCANNER));
new XooPlugin().define(context);
- assertThat(context.getExtensions()).hasSize(43).contains(CpdTokenizerSensor.class);
+ assertThat(context.getExtensions()).hasSize(44).contains(CpdTokenizerSensor.class);
context = new Plugin.Context(new SonarRuntime(Version.parse("5.4"), SonarProduct.SONARLINT, null));
new XooPlugin().define(context);
- assertThat(context.getExtensions()).hasSize(40).doesNotContain(CpdTokenizerSensor.class);
+ assertThat(context.getExtensions()).hasSize(41).doesNotContain(CpdTokenizerSensor.class);
}
}