aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-xoo-plugin
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2023-12-06 16:58:03 +0100
committersonartech <sonartech@sonarsource.com>2023-12-21 20:02:33 +0000
commit0f4fe6e6fb7d11f768c084bbe2ddb7ffd42d7c56 (patch)
tree456c4b2191c11e11f998428384007fb458d70fab /plugins/sonar-xoo-plugin
parentb0af995a136c1ec1b233337f6ee4a15fcd4e0c95 (diff)
downloadsonarqube-0f4fe6e6fb7d11f768c084bbe2ddb7ffd42d7c56.tar.gz
sonarqube-0f4fe6e6fb7d11f768c084bbe2ddb7ffd42d7c56.zip
SONAR-21195 Enhance scanner engine to download only required plugins
Diffstat (limited to 'plugins/sonar-xoo-plugin')
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo2.java15
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java7
2 files changed, 17 insertions, 5 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo2.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo2.java
index 2e5db52e71f..aa371180769 100644
--- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo2.java
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo2.java
@@ -19,17 +19,22 @@
*/
package org.sonar.xoo;
+import java.util.Arrays;
+import org.sonar.api.config.Configuration;
import org.sonar.api.resources.Language;
public class Xoo2 implements Language {
public static final String KEY = "xoo2";
public static final String NAME = "Xoo2";
- public static final String FILE_SUFFIX = ".xoo2";
+ public static final String FILE_SUFFIXES_KEY = "sonar.xoo2.file.suffixes";
+ public static final String DEFAULT_FILE_SUFFIXES = ".xoo2";
- private static final String[] XOO_SUFFIXES = {
- FILE_SUFFIX
- };
+ private final Configuration configuration;
+
+ public Xoo2(Configuration configuration) {
+ this.configuration = configuration;
+ }
@Override
public String getKey() {
@@ -43,7 +48,7 @@ public class Xoo2 implements Language {
@Override
public String[] getFileSuffixes() {
- return XOO_SUFFIXES;
+ return Arrays.stream(configuration.getStringArray(FILE_SUFFIXES_KEY)).filter(s -> s != null && !s.trim().isEmpty()).toArray(String[]::new);
}
@Override
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 d0ed0bb8532..0255cb07000 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
@@ -105,6 +105,13 @@ public class XooPlugin implements Plugin {
.onQualifiers(Qualifiers.PROJECT)
.multiValues(true)
.build(),
+ PropertyDefinition.builder(Xoo2.FILE_SUFFIXES_KEY)
+ .defaultValue(Xoo2.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(),
// Used by DuplicationsTest and IssueFilterOnCommonRulesTest. If not declared it is not returned by api/settings
PropertyDefinition.builder("sonar.cpd.xoo.minimumTokens")
.onQualifiers(Qualifiers.PROJECT)