diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/Xoo2.java | 15 | ||||
-rw-r--r-- | plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java | 7 |
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) |