001 /* 002 * Sonar, open source software quality management tool. 003 * Copyright (C) 2008-2012 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * Sonar is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * Sonar is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with Sonar; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 019 */ 020 package org.sonar.plugins.core; 021 022 import com.google.common.collect.Lists; 023 import org.sonar.api.*; 024 import org.sonar.api.checks.NoSonarFilter; 025 import org.sonar.api.PropertyType; 026 import org.sonar.api.resources.Java; 027 import org.sonar.plugins.core.batch.ExcludedResourceFilter; 028 import org.sonar.plugins.core.batch.IndexProjectPostJob; 029 import org.sonar.plugins.core.batch.MavenInitializer; 030 import org.sonar.plugins.core.batch.ProjectFileSystemLogger; 031 import org.sonar.plugins.core.charts.DistributionAreaChart; 032 import org.sonar.plugins.core.charts.DistributionBarChart; 033 import org.sonar.plugins.core.charts.XradarChart; 034 import org.sonar.plugins.core.colorizers.JavaColorizerFormat; 035 import org.sonar.plugins.core.dashboards.DefaultDashboard; 036 import org.sonar.plugins.core.dashboards.HotspotsDashboard; 037 import org.sonar.plugins.core.dashboards.ReviewsDashboard; 038 import org.sonar.plugins.core.dashboards.TimeMachineDashboard; 039 import org.sonar.plugins.core.security.ApplyProjectRolesDecorator; 040 import org.sonar.plugins.core.sensors.*; 041 import org.sonar.plugins.core.testdetailsviewer.TestsViewerDefinition; 042 import org.sonar.plugins.core.timemachine.*; 043 import org.sonar.plugins.core.web.Lcom4Viewer; 044 import org.sonar.plugins.core.widgets.*; 045 import org.sonar.plugins.core.widgets.actionPlans.ActionPlansWidget; 046 import org.sonar.plugins.core.widgets.reviews.*; 047 048 import java.util.List; 049 050 @Properties({ 051 @Property( 052 key = CoreProperties.SERVER_BASE_URL, 053 defaultValue = CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE, 054 name = "Server base URL", 055 description = "HTTP URL of this Sonar server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.", 056 project = false, 057 global = true, 058 category = CoreProperties.CATEGORY_GENERAL), 059 @Property( 060 key = CoreProperties.CORE_COVERAGE_PLUGIN_PROPERTY, 061 defaultValue = "cobertura", 062 name = "Code coverage plugin", 063 description = "Key of the code coverage plugin to use.", 064 project = true, 065 global = true, 066 category = CoreProperties.CATEGORY_CODE_COVERAGE), 067 @Property( 068 key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY, 069 defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE, 070 name = "Import sources", 071 description = "Set to false if sources should not be displayed, e.g. for security reasons.", 072 project = true, 073 module = true, 074 global = true, 075 category = CoreProperties.CATEGORY_SECURITY, 076 type = PropertyType.BOOLEAN), 077 @Property( 078 key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY, 079 defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE, 080 name = "Tendency period", 081 description = TendencyDecorator.PROP_DAYS_DESCRIPTION, 082 project = false, 083 global = true, 084 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, 085 type = PropertyType.INTEGER), 086 @Property( 087 key = CoreProperties.SKIP_TENDENCIES_PROPERTY, 088 defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE, 089 name = "Skip tendencies", 090 description = "Skip calculation of measure tendencies", 091 project = true, 092 module = false, 093 global = true, 094 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, 095 type = PropertyType.BOOLEAN), 096 @Property( 097 key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY, 098 name = "Exclude modules", 099 description = "Maven artifact ids of modules to exclude (comma-separated).", 100 project = true, 101 global = false, 102 category = CoreProperties.CATEGORY_GENERAL), 103 @Property( 104 key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY, 105 defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE, 106 name = "Force user authentication", 107 description = "Forcing user authentication stops un-logged users to access Sonar.", 108 project = false, 109 global = true, 110 category = CoreProperties.CATEGORY_SECURITY, 111 type = PropertyType.BOOLEAN), 112 @Property( 113 key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, 114 defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE, 115 name = "Allow users to sign up online", 116 description = "Users can sign up online.", 117 project = false, 118 global = true, 119 category = CoreProperties.CATEGORY_SECURITY, 120 type = PropertyType.BOOLEAN), 121 @Property( 122 key = CoreProperties.CORE_DEFAULT_GROUP, 123 defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE, 124 name = "Default user group", 125 description = "Any new users will automatically join this group.", 126 project = false, 127 global = true, 128 category = CoreProperties.CATEGORY_SECURITY), 129 @Property( 130 key = CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY, 131 defaultValue = "en", 132 name = "Locale used for violation messages", 133 description = "Locale to be used when generating violation messages. It's up to each rule engine to support this global internationalization property", 134 project = true, 135 global = true, 136 category = CoreProperties.CATEGORY_L10N), 137 @Property( 138 key = "sonar.timemachine.period1", 139 name = "Period 1", 140 description = "Period used to compare measures and track new violations. Values are : <ul class='bullet'><li>Number of days before " + 141 "analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, for example 2010-12-25</li><li>'previous_analysis' to " + 142 "compare to previous analysis</li></ul>" + 143 "Changing this property only take effect after subsequent project inspections.", 144 project = false, 145 global = true, 146 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1, 147 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), 148 @Property( 149 key = "sonar.timemachine.period2", 150 name = "Period 2", 151 description = "See the property 'Period 1'", 152 project = false, 153 global = true, 154 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2, 155 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), 156 @Property( 157 key = "sonar.timemachine.period3", 158 name = "Period 3", 159 description = "See the property 'Period 1'", 160 project = false, 161 global = true, 162 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3, 163 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), 164 @Property( 165 key = "sonar.timemachine.period4", 166 name = "Period 4", 167 description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : " + 168 "<ul class='bullet'><li>Number of days before analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, " + 169 "for example 2010-12-25</li><li>'previous_analysis' to compare to previous analysis</li><li>A version, for example 1.2</li></ul>" + 170 "Changing this property only take effect after subsequent project inspection.", 171 project = true, 172 global = false, 173 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4, 174 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), 175 @Property( 176 key = "sonar.timemachine.period5", 177 name = "Period 5", 178 description = "See the property 'Period 4'", 179 project = true, 180 global = false, 181 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5, 182 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), 183 184 185 // SERVER-SIDE TECHNICAL PROPERTIES 186 187 @Property( 188 key = "sonar.security.realm", 189 name = "Security Realm", 190 project = false, 191 global = false 192 ), 193 @Property( 194 key = "sonar.security.savePassword", 195 name = "Save external password", 196 project = false, 197 global = false 198 ), 199 @Property( 200 key = "sonar.authenticator.downcase", 201 name = "Downcase login", 202 description = "Downcase login during user authentication, typically for Active Directory", 203 project = false, 204 global = false, 205 defaultValue = "false", 206 type = PropertyType.BOOLEAN), 207 @Property( 208 key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS, 209 name = "Create user accounts", 210 description = "Create accounts when authenticating users via an external system", 211 project = false, 212 global = false, 213 defaultValue = "true", 214 type = PropertyType.BOOLEAN), 215 @Property( 216 key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE, 217 name = "Ignore failures during authenticator startup", 218 defaultValue = "false", 219 project = false, 220 global = false, 221 type = PropertyType.BOOLEAN) 222 }) 223 public final class CorePlugin extends SonarPlugin { 224 225 @SuppressWarnings({"rawtypes", "unchecked"}) 226 public List getExtensions() { 227 List extensions = Lists.newLinkedList(); 228 229 extensions.add(DefaultResourceTypes.class); 230 extensions.add(UserManagedMetrics.class); 231 extensions.add(ProjectFileSystemLogger.class); 232 233 // maven 234 extensions.add(MavenInitializer.class); 235 236 // languages 237 extensions.add(Java.class); 238 239 // pages 240 extensions.add(TestsViewerDefinition.class); 241 extensions.add(Lcom4Viewer.class); 242 243 // widgets 244 extensions.add(AlertsWidget.class); 245 extensions.add(CoverageWidget.class); 246 extensions.add(ItCoverageWidget.class); 247 extensions.add(CommentsDuplicationsWidget.class); 248 extensions.add(DescriptionWidget.class); 249 extensions.add(ComplexityWidget.class); 250 extensions.add(RulesWidget.class); 251 extensions.add(SizeWidget.class); 252 extensions.add(EventsWidget.class); 253 extensions.add(CustomMeasuresWidget.class); 254 extensions.add(TimelineWidget.class); 255 extensions.add(TimeMachineWidget.class); 256 extensions.add(HotspotMetricWidget.class); 257 extensions.add(HotspotMostViolatedResourcesWidget.class); 258 extensions.add(HotspotMostViolatedRulesWidget.class); 259 extensions.add(MyReviewsWidget.class); 260 extensions.add(ProjectReviewsWidget.class); 261 extensions.add(FalsePositiveReviewsWidget.class); 262 extensions.add(ReviewsPerDeveloperWidget.class); 263 extensions.add(PlannedReviewsWidget.class); 264 extensions.add(UnplannedReviewsWidget.class); 265 extensions.add(ActionPlansWidget.class); 266 extensions.add(ReviewsMetricsWidget.class); 267 extensions.add(TreemapWidget.class); 268 269 // dashboards 270 extensions.add(DefaultDashboard.class); 271 extensions.add(HotspotsDashboard.class); 272 extensions.add(ReviewsDashboard.class); 273 extensions.add(TimeMachineDashboard.class); 274 275 // chart 276 extensions.add(XradarChart.class); 277 extensions.add(DistributionBarChart.class); 278 extensions.add(DistributionAreaChart.class); 279 280 // colorizers 281 extensions.add(JavaColorizerFormat.class); 282 283 // batch 284 extensions.add(ProfileSensor.class); 285 extensions.add(ProfileEventsSensor.class); 286 extensions.add(ProjectLinksSensor.class); 287 extensions.add(UnitTestDecorator.class); 288 extensions.add(VersionEventsSensor.class); 289 extensions.add(CheckAlertThresholds.class); 290 extensions.add(GenerateAlertEvents.class); 291 extensions.add(ViolationsDecorator.class); 292 extensions.add(WeightedViolationsDecorator.class); 293 extensions.add(ViolationsDensityDecorator.class); 294 extensions.add(LineCoverageDecorator.class); 295 extensions.add(CoverageDecorator.class); 296 extensions.add(BranchCoverageDecorator.class); 297 extensions.add(ItLineCoverageDecorator.class); 298 extensions.add(ItCoverageDecorator.class); 299 extensions.add(ItBranchCoverageDecorator.class); 300 extensions.add(ApplyProjectRolesDecorator.class); 301 extensions.add(ExcludedResourceFilter.class); 302 extensions.add(CommentDensityDecorator.class); 303 extensions.add(NoSonarFilter.class); 304 extensions.add(DirectoriesDecorator.class); 305 extensions.add(FilesDecorator.class); 306 extensions.add(ReviewNotifications.class); 307 extensions.add(ReviewWorkflowDecorator.class); 308 extensions.add(ReferenceAnalysis.class); 309 extensions.add(ManualMeasureDecorator.class); 310 extensions.add(ManualViolationInjector.class); 311 extensions.add(ViolationSeverityUpdater.class); 312 extensions.add(IndexProjectPostJob.class); 313 extensions.add(ReviewsMeasuresDecorator.class); 314 315 // time machine 316 extensions.add(TendencyDecorator.class); 317 extensions.add(VariationDecorator.class); 318 extensions.add(ViolationTrackingDecorator.class); 319 extensions.add(ViolationPersisterDecorator.class); 320 extensions.add(NewViolationsDecorator.class); 321 extensions.add(TimeMachineConfigurationPersister.class); 322 extensions.add(NewCoverageFileAnalyzer.class); 323 extensions.add(NewItCoverageFileAnalyzer.class); 324 extensions.add(NewCoverageAggregator.class); 325 326 return extensions; 327 } 328 }