You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CorePropertyDefinitions.java 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2021 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.core.config;
  21. import java.util.ArrayList;
  22. import java.util.List;
  23. import org.sonar.api.CoreProperties;
  24. import org.sonar.api.PropertyType;
  25. import org.sonar.api.config.EmailSettings;
  26. import org.sonar.api.config.PropertyDefinition;
  27. import org.sonar.api.resources.Qualifiers;
  28. import static java.util.Arrays.asList;
  29. import static org.sonar.api.PropertyType.BOOLEAN;
  30. import static org.sonar.api.PropertyType.STRING;
  31. public class CorePropertyDefinitions {
  32. public static final String SONAR_ANALYSIS = "sonar.analysis.";
  33. public static final String SONAR_ANALYSIS_DETECTEDSCM = "sonar.analysis.detectedscm";
  34. public static final String SONAR_ANALYSIS_DETECTEDCI = "sonar.analysis.detectedci";
  35. private static final String CATEGORY_ORGANIZATIONS = "organizations";
  36. //TODO remove
  37. @Deprecated
  38. public static final String ORGANIZATIONS_ANYONE_CAN_CREATE = "sonar.organizations.anyoneCanCreate";
  39. //TODO remove
  40. @Deprecated
  41. public static final String ORGANIZATIONS_CREATE_PERSONAL_ORG = "sonar.organizations.createPersonalOrg";
  42. public static final String DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES = "sonar.builtInQualityProfiles.disableNotificationOnUpdate";
  43. private CorePropertyDefinitions() {
  44. // only static stuff
  45. }
  46. public static List<PropertyDefinition> all() {
  47. List<PropertyDefinition> defs = new ArrayList<>();
  48. defs.addAll(IssueExclusionProperties.all());
  49. defs.addAll(ExclusionProperties.all());
  50. defs.addAll(SecurityProperties.all());
  51. defs.addAll(DebtProperties.all());
  52. defs.addAll(PurgeProperties.all());
  53. defs.addAll(EmailSettings.definitions());
  54. defs.addAll(ScannerProperties.all());
  55. defs.addAll(SvnProperties.all());
  56. defs.addAll(asList(
  57. PropertyDefinition.builder(CoreProperties.MODULE_LEVEL_ARCHIVED_SETTINGS)
  58. .name("Archived Sub-Projects Settings")
  59. .description("DEPRECATED - List of the properties that were previously configured at sub-project / module level. " +
  60. "These properties are not used anymore and should now be configured at project level. When you've made the " +
  61. "necessary changes, clear this setting to prevent analysis from showing a warning about it.")
  62. .category(CoreProperties.CATEGORY_GENERAL)
  63. .subCategory(CoreProperties.SUBCATEGORY_MODULES)
  64. .onlyOnQualifiers(Qualifiers.PROJECT)
  65. .type(PropertyType.TEXT)
  66. .build(),
  67. PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL)
  68. .name("Server base URL")
  69. .description("HTTP(S) URL of this SonarQube server, such as <i>https://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.")
  70. .category(CoreProperties.CATEGORY_GENERAL)
  71. .build(),
  72. PropertyDefinition.builder(CoreProperties.ENCRYPTION_SECRET_KEY_PATH)
  73. .name("Encryption secret key path")
  74. .description("Path to a file that contains encryption secret key that is used to encrypting other settings.")
  75. .type(STRING)
  76. .hidden()
  77. .build(),
  78. PropertyDefinition.builder("sonar.authenticator.downcase")
  79. .name("Downcase login")
  80. .description("Downcase login during user authentication, typically for Active Directory")
  81. .type(BOOLEAN)
  82. .defaultValue(String.valueOf(false))
  83. .hidden()
  84. .build(),
  85. PropertyDefinition.builder(DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES)
  86. .name("Avoid quality profiles notification")
  87. .description("Avoid sending email notification on each update of built-in quality profiles to quality profile administrators.")
  88. .defaultValue(Boolean.toString(false))
  89. .category(CoreProperties.CATEGORY_GENERAL)
  90. .type(BOOLEAN)
  91. .build(),
  92. // WEB LOOK&FEEL
  93. PropertyDefinition.builder(WebConstants.SONAR_LF_LOGO_URL)
  94. .deprecatedKey("sonar.branding.image")
  95. .name("Logo URL")
  96. .description("URL to logo image. Any standard format is accepted.")
  97. .category(CoreProperties.CATEGORY_GENERAL)
  98. .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
  99. .build(),
  100. PropertyDefinition.builder(WebConstants.SONAR_LF_LOGO_WIDTH_PX)
  101. .deprecatedKey("sonar.branding.image.width")
  102. .name("Width of image in pixels")
  103. .description("Width in pixels, given that the height of the the image is constrained to 30px.")
  104. .category(CoreProperties.CATEGORY_GENERAL)
  105. .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
  106. .build(),
  107. PropertyDefinition.builder(WebConstants.SONAR_LF_ENABLE_GRAVATAR)
  108. .name("Enable support of gravatars")
  109. .description("Gravatars are profile pictures of users based on their email.")
  110. .type(BOOLEAN)
  111. .defaultValue(String.valueOf(false))
  112. .category(CoreProperties.CATEGORY_GENERAL)
  113. .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
  114. .build(),
  115. PropertyDefinition.builder(WebConstants.SONAR_LF_GRAVATAR_SERVER_URL)
  116. .name("Gravatar URL")
  117. .description("Optional URL of custom Gravatar service. Accepted variables are {EMAIL_MD5} for MD5 hash of email and {SIZE} for the picture size in pixels.")
  118. .defaultValue("https://secure.gravatar.com/avatar/{EMAIL_MD5}.jpg?s={SIZE}&d=identicon")
  119. .category(CoreProperties.CATEGORY_GENERAL)
  120. .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
  121. .build(),
  122. PropertyDefinition.builder(WebConstants.SONAR_LF_ABOUT_TEXT)
  123. .name("About page text")
  124. .description("Optional text that is displayed on the About page. Supports html.")
  125. .category(CoreProperties.CATEGORY_GENERAL)
  126. .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
  127. .type(PropertyType.TEXT)
  128. .build(),
  129. // ISSUES
  130. PropertyDefinition.builder(CoreProperties.DEVELOPER_AGGREGATED_INFO_DISABLED)
  131. .name("Disable developer aggregated information")
  132. .description("Don't show issue facets aggregating information per developer")
  133. .category(CoreProperties.CATEGORY_GENERAL)
  134. .subCategory(CoreProperties.SUBCATEGORY_ISSUES)
  135. .onQualifiers(Qualifiers.PROJECT)
  136. .type(BOOLEAN)
  137. .defaultValue(Boolean.toString(false))
  138. .build(),
  139. PropertyDefinition.builder(CoreProperties.DEFAULT_ISSUE_ASSIGNEE)
  140. .name("Default Assignee")
  141. .description("New issues will be assigned to this user each time it is not possible to determine the user who is the author of the issue.")
  142. .category(CoreProperties.CATEGORY_GENERAL)
  143. .subCategory(CoreProperties.SUBCATEGORY_ISSUES)
  144. .onQualifiers(Qualifiers.PROJECT)
  145. .type(PropertyType.USER_LOGIN)
  146. .build(),
  147. // QUALITY GATE
  148. PropertyDefinition.builder(CoreProperties.QUALITY_GATE_IGNORE_SMALL_CHANGES)
  149. .name("Ignore duplication and coverage on small changes")
  150. .description("Quality Gate conditions about duplications in new code and coverage on new code are ignored until the number of new lines is at least 20.")
  151. .category(CoreProperties.CATEGORY_GENERAL)
  152. .subCategory(CoreProperties.SUBCATEGORY_QUALITY_GATE)
  153. .onQualifiers(Qualifiers.PROJECT)
  154. .type(BOOLEAN)
  155. .defaultValue(Boolean.toString(true))
  156. .build(),
  157. // CPD
  158. PropertyDefinition.builder(CoreProperties.CPD_CROSS_PROJECT)
  159. .defaultValue(Boolean.toString(false))
  160. .name("Cross project duplication detection")
  161. .description("DEPRECATED - By default, SonarQube detects duplications at project level. This means that a block "
  162. + "duplicated on two different projects won't be reported. Setting this parameter to \"true\" "
  163. + "allows to detect duplicates across projects. Note that activating "
  164. + "this property will significantly increase each SonarQube analysis time, "
  165. + "and therefore badly impact the performances of report processing as more and more projects "
  166. + "are getting involved in this cross project duplication mechanism.")
  167. .onQualifiers(Qualifiers.PROJECT)
  168. .category(CoreProperties.CATEGORY_GENERAL)
  169. .subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS)
  170. .type(BOOLEAN)
  171. .build(),
  172. PropertyDefinition.builder(CoreProperties.CPD_EXCLUSIONS)
  173. .defaultValue("")
  174. .name("Duplication Exclusions")
  175. .description("Patterns used to exclude some source files from the duplication detection mechanism. " +
  176. "See below to know how to use wildcards to specify this property.")
  177. .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
  178. .category(CoreProperties.CATEGORY_EXCLUSIONS)
  179. .subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS_EXCLUSIONS)
  180. .multiValues(true)
  181. .build(),
  182. // ORGANIZATIONS
  183. PropertyDefinition.builder(ORGANIZATIONS_ANYONE_CAN_CREATE)
  184. .name("Allow any authenticated user to create organizations.")
  185. .defaultValue(Boolean.toString(false))
  186. .category(CATEGORY_ORGANIZATIONS)
  187. .type(BOOLEAN)
  188. .hidden()
  189. .build()));
  190. return defs;
  191. }
  192. }