001 /*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2008-2011 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.CoreProperties;
024 import org.sonar.api.Properties;
025 import org.sonar.api.Property;
026 import org.sonar.api.SonarPlugin;
027 import org.sonar.api.checks.NoSonarFilter;
028 import org.sonar.api.resources.Java;
029 import org.sonar.plugins.core.batch.ExcludedResourceFilter;
030 import org.sonar.plugins.core.batch.MavenInitializer;
031 import org.sonar.plugins.core.batch.ProjectFileSystemLogger;
032 import org.sonar.plugins.core.charts.DistributionAreaChart;
033 import org.sonar.plugins.core.charts.DistributionBarChart;
034 import org.sonar.plugins.core.charts.XradarChart;
035 import org.sonar.plugins.core.colorizers.JavaColorizerFormat;
036 import org.sonar.plugins.core.hotspots.Hotspots;
037 import org.sonar.plugins.core.metrics.UserManagedMetrics;
038 import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
039 import org.sonar.plugins.core.sensors.*;
040 import org.sonar.plugins.core.testdetailsviewer.TestsViewerDefinition;
041 import org.sonar.plugins.core.timemachine.*;
042 import org.sonar.plugins.core.widgets.*;
043
044 import java.util.List;
045
046 @Properties({
047 @Property(
048 key = CoreProperties.SERVER_BASE_URL,
049 defaultValue = CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE,
050 name = "Server base URL",
051 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.",
052 project = false,
053 global = true,
054 category = CoreProperties.CATEGORY_GENERAL),
055 @Property(
056 key = CoreProperties.CORE_COVERAGE_PLUGIN_PROPERTY,
057 defaultValue = "cobertura",
058 name = "Code coverage plugin",
059 description = "Key of the code coverage plugin to use.",
060 project = true,
061 global = true,
062 category = CoreProperties.CATEGORY_CODE_COVERAGE),
063 @Property(
064 key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY,
065 defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE,
066 name = "Import sources",
067 description = "Set to false if sources should not be displayed, e.g. for security reasons.",
068 project = true,
069 module = true,
070 global = true,
071 category = CoreProperties.CATEGORY_SECURITY),
072 @Property(
073 key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY,
074 defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE,
075 name = "Tendency period",
076 description = TendencyDecorator.PROP_DAYS_DESCRIPTION,
077 project = false,
078 global = true,
079 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
080 @Property(
081 key = CoreProperties.SKIP_TENDENCIES_PROPERTY,
082 defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE,
083 name = "Skip tendencies",
084 description = "Skip calculation of measure tendencies",
085 project = true,
086 module = false,
087 global = true,
088 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
089 @Property(
090 key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY,
091 name = "Exclude modules",
092 description = "Maven artifact ids of modules to exclude (comma-separated).",
093 project = true,
094 global = false,
095 category = CoreProperties.CATEGORY_GENERAL),
096 @Property(
097 key = CoreProperties.CORE_RULE_WEIGHTS_PROPERTY,
098 defaultValue = CoreProperties.CORE_RULE_WEIGHTS_DEFAULT_VALUE,
099 name = "Rules weight",
100 description = "A weight is associated to each priority to calculate the Rules Compliance Index.",
101 project = false,
102 global = true,
103 category = CoreProperties.CATEGORY_GENERAL),
104 @Property(
105 key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY,
106 defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE,
107 name = "Force user authentication",
108 description = "Forcing user authentication stops un-logged users to access Sonar.",
109 project = false,
110 global = true,
111 category = CoreProperties.CATEGORY_SECURITY),
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 @Property(
121 key = CoreProperties.CORE_DEFAULT_GROUP,
122 defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE,
123 name = "Default user group",
124 description = "Any new users will automatically join this group.",
125 project = false,
126 global = true,
127 category = CoreProperties.CATEGORY_SECURITY),
128 @Property(
129 key = CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY,
130 defaultValue = "en",
131 name = "Locale used for violation messages",
132 description = "Locale to be used when generating violation messages. It's up to each rule engine to support this global internationalization property",
133 project = true,
134 global = true,
135 category = CoreProperties.CATEGORY_L10N),
136 @Property(
137 key = "sonar.timemachine.period1",
138 name = "Period 1",
139 description = "Period used to compare measures and track new violations. Values are : <ul class='bullet'><li>Number of days before " +
140 "analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, for example 2010-12-25</li><li>'previous_analysis' to " +
141 "compare to previous analysis</li><li>A version, for example 1.2</li></ul>",
142 project = false,
143 global = true,
144 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1,
145 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
146 @Property(
147 key = "sonar.timemachine.period2",
148 name = "Period 2",
149 description = "See the property 'Period 1'",
150 project = false,
151 global = true,
152 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2,
153 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
154 @Property(
155 key = "sonar.timemachine.period3",
156 name = "Period 3",
157 description = "See the property 'Period 1'",
158 project = false,
159 global = true,
160 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3,
161 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
162 @Property(
163 key = "sonar.timemachine.period4",
164 name = "Period 4",
165 description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : " +
166 "<ul class='bullet'><li>Number of days before analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, " +
167 "for example 2010-12-25</li><li>'previous_analysis' to compare to previous analysis</li><li>A version, for example 1.2</li></ul>",
168 project = true,
169 global = false,
170 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4,
171 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
172 @Property(
173 key = "sonar.timemachine.period5",
174 name = "Period 5",
175 description = "See the property 'Period 4'",
176 project = true,
177 global = false,
178 defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5,
179 category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
180
181
182 // SERVER-SIDE TECHNICAL PROPERTIES
183
184 @Property(
185 key = "sonar.useStructureDump",
186 name = "Use Structure Dump",
187 description = "Used when creating database schema",
188 project = false,
189 global = false,
190 defaultValue = "true"),
191 @Property(
192 key = "sonar.authenticator.downcase",
193 name = "Downcase login",
194 description = "Downcase login during user authentication, typically for Active Directory",
195 project = false,
196 global = false,
197 defaultValue = "false"),
198 @Property(
199 key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS,
200 name = "Create user accounts",
201 description = "Create accounts when authenticating users via an external system",
202 project = false,
203 global = false,
204 defaultValue = "false"),
205 @Property(
206 key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE,
207 name = "Ignore failures during authenticator startup",
208 defaultValue = "false",
209 project = false,
210 global = false)
211 })
212 public class CorePlugin extends SonarPlugin {
213
214 @SuppressWarnings({ "rawtypes", "unchecked" })
215 public List getExtensions() {
216 List extensions = Lists.newLinkedList();
217
218 extensions.add(ProjectFileSystemLogger.class);
219
220 // maven
221 extensions.add(MavenInitializer.class);
222
223 // languages
224 extensions.add(Java.class);
225
226 // metrics
227 extensions.add(UserManagedMetrics.class);
228
229 // pages
230 extensions.add(TestsViewerDefinition.class);
231 extensions.add(Hotspots.class);
232
233 // widgets
234 extensions.add(AlertsWidget.class);
235 extensions.add(CoverageWidget.class);
236 extensions.add(ItCoverageWidget.class);
237 extensions.add(CommentsDuplicationsWidget.class);
238 extensions.add(DescriptionWidget.class);
239 extensions.add(ComplexityWidget.class);
240 extensions.add(RulesWidget.class);
241 extensions.add(SizeWidget.class);
242 extensions.add(EventsWidget.class);
243 extensions.add(CustomMeasuresWidget.class);
244 extensions.add(TimelineWidget.class);
245 extensions.add(TimeMachineWidget.class);
246 extensions.add(HotspotMetricWidget.class);
247 extensions.add(HotspotMostViolatedResourcesWidget.class);
248 extensions.add(HotspotMostViolatedRulesWidget.class);
249
250 // chart
251 extensions.add(XradarChart.class);
252 extensions.add(DistributionBarChart.class);
253 extensions.add(DistributionAreaChart.class);
254
255 // colorizers
256 extensions.add(JavaColorizerFormat.class);
257
258 // batch
259 extensions.add(ProfileSensor.class);
260 extensions.add(ProfileEventsSensor.class);
261 extensions.add(ProjectLinksSensor.class);
262 extensions.add(UnitTestDecorator.class);
263 extensions.add(VersionEventsSensor.class);
264 extensions.add(CheckAlertThresholds.class);
265 extensions.add(GenerateAlertEvents.class);
266 extensions.add(ViolationsDecorator.class);
267 extensions.add(WeightedViolationsDecorator.class);
268 extensions.add(ViolationsDensityDecorator.class);
269 extensions.add(LineCoverageDecorator.class);
270 extensions.add(CoverageDecorator.class);
271 extensions.add(BranchCoverageDecorator.class);
272 extensions.add(ItLineCoverageDecorator.class);
273 extensions.add(ItCoverageDecorator.class);
274 extensions.add(ItBranchCoverageDecorator.class);
275 extensions.add(ApplyProjectRolesDecorator.class);
276 extensions.add(ExcludedResourceFilter.class);
277 extensions.add(CommentDensityDecorator.class);
278 extensions.add(NoSonarFilter.class);
279 extensions.add(DirectoriesDecorator.class);
280 extensions.add(FilesDecorator.class);
281 extensions.add(CloseReviewsDecorator.class);
282 extensions.add(ReferenceAnalysis.class);
283 extensions.add(ManualMeasureDecorator.class);
284
285 // time machine
286 extensions.add(TendencyDecorator.class);
287 extensions.add(VariationDecorator.class);
288 extensions.add(ViolationTrackingDecorator.class);
289 extensions.add(ViolationPersisterDecorator.class);
290 extensions.add(NewViolationsDecorator.class);
291 extensions.add(TimeMachineConfigurationPersister.class);
292 extensions.add(NewCoverageFileAnalyzer.class);
293 extensions.add(NewItCoverageFileAnalyzer.class);
294 extensions.add(NewCoverageAggregator.class);
295
296 return extensions;
297 }
298 }