aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2021-12-20 10:49:11 -0600
committersonartech <sonartech@sonarsource.com>2021-12-21 20:03:11 +0000
commit32a5fecb407c19060301d2364d12002135b2aefe (patch)
tree74bf77a96333d521a35372228400ab0478ada08c /sonar-plugin-api/src
parentdfe37e01a74c746c860250627ec3a28fdb0eea8d (diff)
downloadsonarqube-32a5fecb407c19060301d2364d12002135b2aefe.tar.gz
sonarqube-32a5fecb407c19060301d2364d12002135b2aefe.zip
SONAR-15836 Language files are not automatically published
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java7
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java7
2 files changed, 13 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java
index 18c4f94781e..1dc5e9145e5 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java
@@ -53,4 +53,11 @@ public interface Language {
*/
String[] getFileSuffixes();
+ /**
+ * Whether all files identified with this language should be sent to SonarQube, even if no data is reported for them
+ * @since 9.3
+ */
+ default boolean publishAllFiles() {
+ return true;
+ }
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java
index d1fd1d782de..73256aace1c 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java
@@ -52,6 +52,11 @@ public class AbstractLanguageTest {
public String[] getFileSuffixes() {
return lang1.getFileSuffixes();
}
+
+ @Override
+ public boolean publishAllFiles() {
+ return true;
+ }
})).isTrue();
assertThat(lang1)
@@ -61,7 +66,7 @@ public class AbstractLanguageTest {
@Test
public void should_not_define_language_with_too_long_key() {
- assertThatThrownBy(() -> new TooLongKeyLanguage())
+ assertThatThrownBy(TooLongKeyLanguage::new)
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("The following language key exceeds 20 characters: 'aKeyWhichIsVeryVeryVeryVeryVeryLong'");
}