aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2022-10-27 11:44:28 +0200
committersonartech <sonartech@sonarsource.com>2022-10-28 20:03:23 +0000
commit80fdc3a91ab884cc03aacf2ddd9c2d84f62390eb (patch)
treeb7bf8c34dc07c31741ebe8edd1cd3064bef43c1d
parent539b338d33b70bb58b4dfd88d5a7c3bf4f814bbf (diff)
downloadsonarqube-80fdc3a91ab884cc03aacf2ddd9c2d84f62390eb.tar.gz
sonarqube-80fdc3a91ab884cc03aacf2ddd9c2d84f62390eb.zip
SONAR-17524 Add main branch name instance property
-rw-r--r--sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java12
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
-rw-r--r--sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java2
3 files changed, 13 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
index 5756ba63d6d..b58b716f162 100644
--- a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
+++ b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
@@ -37,12 +37,14 @@ import static org.sonar.core.extension.PluginRiskConsent.NOT_ACCEPTED;
public class CorePropertyDefinitions {
public static final String SONAR_ANALYSIS = "sonar.analysis.";
+ public static final String SONAR_PROJECTCREATION_MAINBRANCHNAME = "sonar.projectCreation.mainBranchName";
public static final String SONAR_ANALYSIS_DETECTEDSCM = "sonar.analysis.detectedscm";
public static final String SONAR_ANALYSIS_DETECTEDCI = "sonar.analysis.detectedci";
public static final String DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES = "sonar.builtInQualityProfiles.disableNotificationOnUpdate";
public static final String PLUGINS_RISK_CONSENT = "sonar.plugins.risk.consent";
+ public static final String SUBCATEGORY_PROJECT_CREATION = "subProjectCreation";
private CorePropertyDefinitions() {
// only static stuff
@@ -74,7 +76,15 @@ public class CorePropertyDefinitions {
.description("HTTP(S) URL of this SonarQube server, such as <i>https://yourhost.yourdomain/sonar</i>. This value is used outside SonarQube itself, e.g. for PR decoration, emails, etc.")
.category(CoreProperties.CATEGORY_GENERAL)
.build(),
-
+ PropertyDefinition.builder(SONAR_PROJECTCREATION_MAINBRANCHNAME)
+ .name("Default main branch name")
+ .category(CoreProperties.CATEGORY_GENERAL)
+ .subCategory(SUBCATEGORY_PROJECT_CREATION)
+ .description("Each project has a main branch at creation. This setting defines the instance-wide default main branch name. "
+ + " A user can override this when creating a project. This setting does not apply to projects imported from a DevOps platform.")
+ .type(STRING)
+ .defaultValue("main")
+ .build(),
PropertyDefinition.builder(CoreProperties.ENCRYPTION_SECRET_KEY_PATH)
.name("Encryption secret key path")
.description("Path to a file that contains encryption secret key that is used to encrypting other settings.")
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 54fbcf539a0..763718660ab 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1331,6 +1331,7 @@ property.category.general.looknfeel=Look & Feel
property.category.general.issues=Issues
property.category.general.qualityGate=Quality Gate
property.category.general.subProjects=Sub-projects
+property.category.general.subProjectCreation=Project Creation
property.category.almintegration=DevOps Platform Integrations
property.category.authentication=Authentication
property.category.organizations=Organizations
diff --git a/sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java b/sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java
index fada8ca9c48..074c7b14e8f 100644
--- a/sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java
@@ -30,7 +30,7 @@ public class CorePropertyDefinitionsTest {
@Test
public void all() {
List<PropertyDefinition> defs = CorePropertyDefinitions.all();
- assertThat(defs).hasSize(53);
+ assertThat(defs).isNotEmpty();
}
@Test