From 80fdc3a91ab884cc03aacf2ddd9c2d84f62390eb Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Thu, 27 Oct 2022 11:44:28 +0200 Subject: SONAR-17524 Add main branch name instance property --- .../java/org/sonar/core/config/CorePropertyDefinitions.java | 12 +++++++++++- sonar-core/src/main/resources/org/sonar/l10n/core.properties | 1 + .../org/sonar/core/config/CorePropertyDefinitionsTest.java | 2 +- 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 https://yourhost.yourdomain/sonar. 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 defs = CorePropertyDefinitions.all(); - assertThat(defs).hasSize(53); + assertThat(defs).isNotEmpty(); } @Test -- cgit v1.2.3