]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17524 Add main branch name instance property
authorMathieu Suen <mathieu.suen@sonarsource.com>
Thu, 27 Oct 2022 09:44:28 +0000 (11:44 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 28 Oct 2022 20:03:23 +0000 (20:03 +0000)
sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
sonar-core/src/main/resources/org/sonar/l10n/core.properties
sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java

index 5756ba63d6da26a8eb9787c908e820962e41db45..b58b716f1628840205051c047c9cde905518aaef 100644 (file)
@@ -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.")
index 54fbcf539a0afca9c778814520ff8dc2a6795a8c..763718660ab94f3bae9ba2913bdbf6da4c5fef87 100644 (file)
@@ -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
index fada8ca9c488e1275110f9f7aa1ba7ce0db767bf..074c7b14e8f9ac651b372871f96a7abbec31972b 100644 (file)
@@ -30,7 +30,7 @@ public class CorePropertyDefinitionsTest {
   @Test
   public void all() {
     List<PropertyDefinition> defs = CorePropertyDefinitions.all();
-    assertThat(defs).hasSize(53);
+    assertThat(defs).isNotEmpty();
   }
 
   @Test