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 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2023 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.Arrays;
  23. import java.util.List;
  24. import java.util.stream.Collectors;
  25. import org.sonar.api.CoreProperties;
  26. import org.sonar.api.PropertyType;
  27. import org.sonar.api.config.EmailSettings;
  28. import org.sonar.api.config.PropertyDefinition;
  29. import org.sonar.api.resources.Qualifiers;
  30. import org.sonar.core.documentation.DefaultDocumentationLinkGenerator;
  31. import org.sonar.core.extension.PluginRiskConsent;
  32. import static java.util.Arrays.asList;
  33. import static org.sonar.api.PropertyType.BOOLEAN;
  34. import static org.sonar.api.PropertyType.SINGLE_SELECT_LIST;
  35. import static org.sonar.api.PropertyType.STRING;
  36. import static org.sonar.api.PropertyType.TEXT;
  37. import static org.sonar.core.extension.PluginRiskConsent.NOT_ACCEPTED;
  38. public class CorePropertyDefinitions {
  39. public static final String SONAR_ANALYSIS = "sonar.analysis.";
  40. public static final String SONAR_PROJECTCREATION_MAINBRANCHNAME = "sonar.projectCreation.mainBranchName";
  41. public static final String SONAR_ANALYSIS_DETECTEDSCM = "sonar.analysis.detectedscm";
  42. public static final String SONAR_ANALYSIS_DETECTEDCI = "sonar.analysis.detectedci";
  43. public static final String DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES = "sonar.builtInQualityProfiles.disableNotificationOnUpdate";
  44. public static final String PLUGINS_RISK_CONSENT = "sonar.plugins.risk.consent";
  45. public static final String DOCUMENTATION_BASE_URL = "sonar.documentation.baseUrl";
  46. public static final String SUBCATEGORY_PROJECT_CREATION = "subProjectCreation";
  47. private CorePropertyDefinitions() {
  48. // only static stuff
  49. }
  50. public static List<PropertyDefinition> all() {
  51. List<PropertyDefinition> defs = new ArrayList<>();
  52. defs.addAll(IssueExclusionProperties.all());
  53. defs.addAll(ExclusionProperties.all());
  54. defs.addAll(SecurityProperties.all());
  55. defs.addAll(DebtProperties.all());
  56. defs.addAll(PurgeProperties.all());
  57. defs.addAll(EmailSettings.definitions());
  58. defs.addAll(ScannerProperties.all());
  59. defs.addAll(asList(
  60. PropertyDefinition.builder(CoreProperties.MODULE_LEVEL_ARCHIVED_SETTINGS)
  61. .name("Archived Sub-Projects Settings")
  62. .description("DEPRECATED - List of the properties that were previously configured at sub-project / module level. " +
  63. "These properties are not used anymore and should now be configured at project level. When you've made the " +
  64. "necessary changes, clear this setting to prevent analysis from showing a warning about it.")
  65. .category(CoreProperties.CATEGORY_GENERAL)
  66. .subCategory(CoreProperties.SUBCATEGORY_MODULES)
  67. .onlyOnQualifiers(Qualifiers.PROJECT)
  68. .type(TEXT)
  69. .build(),
  70. PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL)
  71. .name("Server base URL")
  72. .description(
  73. "HTTP(S) URL of this SonarQube server, such as <i>https://yourhost.yourdomain/sonar</i>. "
  74. + "This value is used outside SonarQube itself, e.g. for PR decoration, emails, etc.")
  75. .category(CoreProperties.CATEGORY_GENERAL)
  76. .build(),
  77. PropertyDefinition.builder(SONAR_PROJECTCREATION_MAINBRANCHNAME)
  78. .name("Default main branch name")
  79. .category(CoreProperties.CATEGORY_GENERAL)
  80. .subCategory(SUBCATEGORY_PROJECT_CREATION)
  81. .description("Each project has a main branch at creation. This setting defines the instance-wide default main branch name. "
  82. + " A user can override this when creating a project. This setting does not apply to projects imported from a DevOps platform.")
  83. .type(STRING)
  84. .defaultValue("main")
  85. .build(),
  86. PropertyDefinition.builder(CoreProperties.ENCRYPTION_SECRET_KEY_PATH)
  87. .name("Encryption secret key path")
  88. .description("Path to a file that contains encryption secret key that is used to encrypting other settings.")
  89. .type(STRING)
  90. .hidden()
  91. .build(),
  92. PropertyDefinition.builder("sonar.authenticator.downcase")
  93. .name("Downcase login")
  94. .description("Downcase login during user authentication, typically for Active Directory")
  95. .type(BOOLEAN)
  96. .defaultValue(String.valueOf(false))
  97. .hidden()
  98. .build(),
  99. PropertyDefinition.builder(DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES)
  100. .name("Avoid quality profiles notification")
  101. .description("Avoid sending email notification on each update of built-in quality profiles to quality profile administrators.")
  102. .defaultValue(Boolean.toString(false))
  103. .category(CoreProperties.CATEGORY_GENERAL)
  104. .type(BOOLEAN)
  105. .build(),
  106. PropertyDefinition.builder(PLUGINS_RISK_CONSENT)
  107. .name("State of user plugins risk consent")
  108. .description("Determine whether user is required to accept plugins risk consent")
  109. .defaultValue(NOT_ACCEPTED.name())
  110. .options(Arrays.stream(PluginRiskConsent.values()).map(Enum::name).collect(Collectors.toList()))
  111. .hidden()
  112. .type(SINGLE_SELECT_LIST)
  113. .build(),
  114. PropertyDefinition.builder(DOCUMENTATION_BASE_URL)
  115. .name("Base URL of the documentation")
  116. .description("Base URL to be used in SonarQube documentation links, such as <i>https://docs.sonarsource.com/sonarqube/</i>")
  117. .defaultValue(DefaultDocumentationLinkGenerator.DOCUMENTATION_PUBLIC_URL)
  118. .hidden()
  119. .type(STRING)
  120. .build(),
  121. // WEB LOOK&FEEL
  122. PropertyDefinition.builder(WebConstants.SONAR_LF_LOGO_URL)
  123. .deprecatedKey("sonar.branding.image")
  124. .name("Logo URL")
  125. .description("URL to logo image. Any standard format is accepted.")
  126. .category(CoreProperties.CATEGORY_GENERAL)
  127. .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
  128. .build(),
  129. PropertyDefinition.builder(WebConstants.SONAR_LF_LOGO_WIDTH_PX)
  130. .deprecatedKey("sonar.branding.image.width")
  131. .name("Width of image in pixels")
  132. .description("Width in pixels, constrained to 150px (the height of the image is constrained to 40px).")
  133. .category(CoreProperties.CATEGORY_GENERAL)
  134. .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
  135. .build(),
  136. PropertyDefinition.builder(WebConstants.SONAR_LF_ENABLE_GRAVATAR)
  137. .name("Enable support of gravatars")
  138. .description("Gravatars are profile pictures of users based on their email.")
  139. .type(BOOLEAN)
  140. .defaultValue(String.valueOf(false))
  141. .category(CoreProperties.CATEGORY_GENERAL)
  142. .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
  143. .build(),
  144. PropertyDefinition.builder(WebConstants.SONAR_LF_GRAVATAR_SERVER_URL)
  145. .name("Gravatar URL")
  146. .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.")
  147. .defaultValue("https://secure.gravatar.com/avatar/{EMAIL_MD5}.jpg?s={SIZE}&d=identicon")
  148. .category(CoreProperties.CATEGORY_GENERAL)
  149. .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
  150. .build(),
  151. // ISSUES
  152. PropertyDefinition.builder(CoreProperties.DEVELOPER_AGGREGATED_INFO_DISABLED)
  153. .name("Disable developer aggregated information")
  154. .description("Don't show issue facets aggregating information per developer")
  155. .category(CoreProperties.CATEGORY_GENERAL)
  156. .subCategory(CoreProperties.SUBCATEGORY_ISSUES)
  157. .onQualifiers(Qualifiers.PROJECT)
  158. .type(BOOLEAN)
  159. .defaultValue(Boolean.toString(false))
  160. .build(),
  161. PropertyDefinition.builder(CoreProperties.DEFAULT_ISSUE_ASSIGNEE)
  162. .name("Default Assignee")
  163. .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.")
  164. .category(CoreProperties.CATEGORY_GENERAL)
  165. .subCategory(CoreProperties.SUBCATEGORY_ISSUES)
  166. .onQualifiers(Qualifiers.PROJECT)
  167. .type(PropertyType.USER_LOGIN)
  168. .build(),
  169. // QUALITY GATE
  170. PropertyDefinition.builder(CoreProperties.QUALITY_GATE_IGNORE_SMALL_CHANGES)
  171. .name("Ignore duplication and coverage on small changes")
  172. .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.")
  173. .category(CoreProperties.CATEGORY_GENERAL)
  174. .subCategory(CoreProperties.SUBCATEGORY_QUALITY_GATE)
  175. .onQualifiers(Qualifiers.PROJECT)
  176. .type(BOOLEAN)
  177. .defaultValue(Boolean.toString(true))
  178. .build(),
  179. // CPD
  180. PropertyDefinition.builder(CoreProperties.CPD_CROSS_PROJECT)
  181. .defaultValue(Boolean.toString(false))
  182. .name("Cross project duplication detection")
  183. .description("DEPRECATED - By default, SonarQube detects duplications at project level. This means that a block "
  184. + "duplicated on two different projects won't be reported. Setting this parameter to \"true\" "
  185. + "allows to detect duplicates across projects. Note that activating "
  186. + "this property will significantly increase each SonarQube analysis time, "
  187. + "and therefore badly impact the performances of report processing as more and more projects "
  188. + "are getting involved in this cross project duplication mechanism.")
  189. .onQualifiers(Qualifiers.PROJECT)
  190. .category(CoreProperties.CATEGORY_GENERAL)
  191. .subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS)
  192. .type(BOOLEAN)
  193. .build(),
  194. PropertyDefinition.builder(CoreProperties.CPD_EXCLUSIONS)
  195. .defaultValue("")
  196. .name("Duplication Exclusions")
  197. .description("Patterns used to exclude some source files from the duplication detection mechanism. " +
  198. "See below to know how to use wildcards to specify this property.")
  199. .onQualifiers(Qualifiers.PROJECT)
  200. .category(CoreProperties.CATEGORY_EXCLUSIONS)
  201. .subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS_EXCLUSIONS)
  202. .multiValues(true)
  203. .build()));
  204. return defs;
  205. }
  206. }