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>2024-01-04 20:02:48 +0000
commit7013e543f07fca1831fd1efee29997981b6ec19b (patch)
tree658cc82afdefacdfa1e1454cc78fd9c3dbf5d652 /plugins/sonar-xoo-plugin
parent8fd8c030e7dda6eb03c83eb4e59474f5e2d4e401 (diff)
downloadsonarqube-7013e543f07fca1831fd1efee29997981b6ec19b.tar.gz
sonarqube-7013e543f07fca1831fd1efee29997981b6ec19b.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 f107e209357..367408c1af4 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 1ce6c31e77d..5277c977da7 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)