*/ | */ | ||||
package org.sonar.plugins.checkstyle; | package org.sonar.plugins.checkstyle; | ||||
import org.sonar.api.SonarPlugin; | |||||
import org.sonar.api.Properties; | import org.sonar.api.Properties; | ||||
import org.sonar.api.Property; | import org.sonar.api.Property; | ||||
import org.sonar.api.SonarPlugin; | |||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.List; | import java.util.List; | ||||
@Properties( { | |||||
@Properties({ | |||||
@Property(key = CheckstyleConstants.FILTERS_KEY, | @Property(key = CheckstyleConstants.FILTERS_KEY, | ||||
defaultValue = CheckstyleConstants.FILTERS_DEFAULT_VALUE, | |||||
name = "Filters", | |||||
description = "Checkstyle support three error filtering mechanisms : SuppressionCommentFilter, SuppressWithNearbyCommentFilter and SuppressionFilter." | |||||
+ "This property allows to configure all those filters with a native XML format." | |||||
+ " See <a href='http://checkstyle.sourceforge.net/config.html'>Checkstyle configuration page</a> to get more information on those filters.", | |||||
project = false, global = true) }) | |||||
public class CheckstylePlugin extends SonarPlugin { | |||||
defaultValue = CheckstyleConstants.FILTERS_DEFAULT_VALUE, | |||||
name = "Filters", | |||||
description = "Checkstyle support three error filtering mechanisms : SuppressionCommentFilter, SuppressWithNearbyCommentFilter and SuppressionFilter." | |||||
+ "This property allows to configure all those filters with a native XML format." | |||||
+ " See <a href='http://checkstyle.sourceforge.net/config.html'>Checkstyle configuration page</a> to get more information on those filters.", | |||||
project = false, | |||||
global = true, | |||||
type = Property.Type.TEXT)}) | |||||
public final class CheckstylePlugin extends SonarPlugin { | |||||
public List getExtensions() { | public List getExtensions() { | ||||
return Arrays.asList( | return Arrays.asList( | ||||
CheckstyleSensor.class, | |||||
CheckstyleConfiguration.class, | |||||
CheckstyleExecutor.class, | |||||
CheckstyleAuditListener.class, | |||||
CheckstyleProfileExporter.class, | |||||
CheckstyleProfileImporter.class, | |||||
CheckstyleRuleRepository.class, | |||||
SonarWayProfile.class, | |||||
SunConventionsProfile.class, | |||||
SonarWayWithFindbugsProfile.class); | |||||
CheckstyleSensor.class, | |||||
CheckstyleConfiguration.class, | |||||
CheckstyleExecutor.class, | |||||
CheckstyleAuditListener.class, | |||||
CheckstyleProfileExporter.class, | |||||
CheckstyleProfileImporter.class, | |||||
CheckstyleRuleRepository.class, | |||||
SonarWayProfile.class, | |||||
SunConventionsProfile.class, | |||||
SonarWayWithFindbugsProfile.class); | |||||
} | } | ||||
} | } |
project = true, | project = true, | ||||
module = true, | module = true, | ||||
global = true, | global = true, | ||||
category = CoreProperties.CATEGORY_SECURITY), | |||||
category = CoreProperties.CATEGORY_SECURITY, | |||||
type = Property.Type.BOOLEAN), | |||||
@Property( | @Property( | ||||
key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY, | key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY, | ||||
defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE, | defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE, | ||||
description = TendencyDecorator.PROP_DAYS_DESCRIPTION, | description = TendencyDecorator.PROP_DAYS_DESCRIPTION, | ||||
project = false, | project = false, | ||||
global = true, | global = true, | ||||
category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), | |||||
category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, | |||||
type = Property.Type.INTEGER), | |||||
@Property( | @Property( | ||||
key = CoreProperties.SKIP_TENDENCIES_PROPERTY, | key = CoreProperties.SKIP_TENDENCIES_PROPERTY, | ||||
defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE, | defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE, | ||||
project = true, | project = true, | ||||
module = false, | module = false, | ||||
global = true, | global = true, | ||||
category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS), | |||||
category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS, | |||||
type = Property.Type.BOOLEAN), | |||||
@Property( | @Property( | ||||
key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY, | key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY, | ||||
name = "Exclude modules", | name = "Exclude modules", | ||||
description = "Forcing user authentication stops un-logged users to access Sonar.", | description = "Forcing user authentication stops un-logged users to access Sonar.", | ||||
project = false, | project = false, | ||||
global = true, | global = true, | ||||
category = CoreProperties.CATEGORY_SECURITY), | |||||
category = CoreProperties.CATEGORY_SECURITY, | |||||
type = Property.Type.BOOLEAN), | |||||
@Property( | @Property( | ||||
key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, | key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, | ||||
defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE, | defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE, | ||||
description = "Users can sign up online.", | description = "Users can sign up online.", | ||||
project = false, | project = false, | ||||
global = true, | global = true, | ||||
category = CoreProperties.CATEGORY_SECURITY), | |||||
category = CoreProperties.CATEGORY_SECURITY, | |||||
type = Property.Type.BOOLEAN), | |||||
@Property( | @Property( | ||||
key = CoreProperties.CORE_DEFAULT_GROUP, | key = CoreProperties.CORE_DEFAULT_GROUP, | ||||
defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE, | defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE, | ||||
description = "Downcase login during user authentication, typically for Active Directory", | description = "Downcase login during user authentication, typically for Active Directory", | ||||
project = false, | project = false, | ||||
global = false, | global = false, | ||||
defaultValue = "false"), | |||||
defaultValue = "false", | |||||
type = Property.Type.BOOLEAN), | |||||
@Property( | @Property( | ||||
key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS, | key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS, | ||||
name = "Create user accounts", | name = "Create user accounts", | ||||
description = "Create accounts when authenticating users via an external system", | description = "Create accounts when authenticating users via an external system", | ||||
project = false, | project = false, | ||||
global = false, | global = false, | ||||
defaultValue = "true"), | |||||
defaultValue = "true", | |||||
type = Property.Type.BOOLEAN), | |||||
@Property( | @Property( | ||||
key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE, | key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE, | ||||
name = "Ignore failures during authenticator startup", | name = "Ignore failures during authenticator startup", | ||||
defaultValue = "false", | defaultValue = "false", | ||||
project = false, | project = false, | ||||
global = false) | |||||
global = false, | |||||
type = Property.Type.BOOLEAN) | |||||
}) | }) | ||||
public class CorePlugin extends SonarPlugin { | |||||
public final class CorePlugin extends SonarPlugin { | |||||
@SuppressWarnings({"rawtypes", "unchecked"}) | @SuppressWarnings({"rawtypes", "unchecked"}) | ||||
public List getExtensions() { | public List getExtensions() { |
import java.util.List; | import java.util.List; | ||||
@Properties({ | @Properties({ | ||||
@Property( | |||||
key = CoreProperties.CPD_ENGINE, | |||||
defaultValue = CoreProperties.CPD_ENGINE_DEFAULT_VALUE, | |||||
name = "Copy&Paste detection engine", | |||||
description = "Sonar embeds its own CPD engine since Sonar 2.11, but it's still possible to use the old PMD CPD engine (value 'pmd')." + | |||||
" Some Sonar users might want to keep on working with PMD CPD engine for instance to prevent any impact on measures during an upgrade of Sonar." + | |||||
" Moreover this Sonar CPD engine is not supported by all Sonar language plugins and when this support is not available," + | |||||
" the PMD CPD engine is automatically selected.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS), | |||||
@Property( | |||||
key = CoreProperties.CPD_CROSS_RPOJECT, | |||||
defaultValue = CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "", | |||||
name = "Cross project duplicaton detection", | |||||
description = "Sonar supports the detection of cross project duplications." + | |||||
" Activating this property will slightly increase each Sonar analysis time." + | |||||
" This mode can't be used along with the PMD CPD engine.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS), | |||||
@Property( | |||||
key = CoreProperties.CPD_MINIMUM_TOKENS_PROPERTY, | |||||
defaultValue = CoreProperties.CPD_MINIMUM_TOKENS_DEFAULT_VALUE + "", | |||||
name = "Minimum tokens", | |||||
description = "Deprecated property used only by the PMD CPD engine." + | |||||
" The number of duplicate tokens above which a block is considered as a duplication.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS), | |||||
@Property( | |||||
key = CoreProperties.CPD_IGNORE_LITERALS_PROPERTY, | |||||
defaultValue = CoreProperties.CPD_IGNORE_LITERALS_DEFAULT_VALUE + "", | |||||
name = "Ignore literals", | |||||
description = "Deprecated property used only by the PMD CPD engine." + | |||||
" If true, PMD-CPD ignores literal value differences when evaluating a duplicate block." + | |||||
" This means that foo=\"first string\"; and foo=\"second string\"; will be seen as equivalent.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS), | |||||
@Property( | |||||
key = CoreProperties.CPD_IGNORE_IDENTIFIERS_PROPERTY, | |||||
defaultValue = CoreProperties.CPD_IGNORE_IDENTIFIERS_DEFAULT_VALUE + "", | |||||
name = "Ignore identifiers", | |||||
description = "Deprecated property used only by the PMD CPD engine." + | |||||
" Similar to 'Ignore literals' but for identifiers; i.e., variable names, methods names, and so forth.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS) | |||||
@Property( | |||||
key = CoreProperties.CPD_ENGINE, | |||||
defaultValue = CoreProperties.CPD_ENGINE_DEFAULT_VALUE, | |||||
name = "Copy&Paste detection engine", | |||||
description = "Sonar embeds its own CPD engine since Sonar 2.11, but it's still possible to use the old PMD CPD engine (value 'pmd')." + | |||||
" Some Sonar users might want to keep on working with PMD CPD engine for instance to prevent any impact on measures during an upgrade of Sonar." + | |||||
" Moreover this Sonar CPD engine is not supported by all Sonar language plugins and when this support is not available," + | |||||
" the PMD CPD engine is automatically selected.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS, | |||||
type = Property.Type.SINGLE_SELECT_LIST, | |||||
options = {"sonar", "pmd"}), | |||||
@Property( | |||||
key = CoreProperties.CPD_CROSS_RPOJECT, | |||||
defaultValue = CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "", | |||||
name = "Cross project duplicaton detection", | |||||
description = "Sonar supports the detection of cross project duplications." + | |||||
" Activating this property will slightly increase each Sonar analysis time." + | |||||
" This mode can't be used along with the PMD CPD engine.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS, | |||||
type = Property.Type.BOOLEAN), | |||||
@Property( | |||||
key = CoreProperties.CPD_MINIMUM_TOKENS_PROPERTY, | |||||
defaultValue = CoreProperties.CPD_MINIMUM_TOKENS_DEFAULT_VALUE + "", | |||||
name = "Minimum tokens", | |||||
description = "Deprecated property used only by the PMD CPD engine." + | |||||
" The number of duplicate tokens above which a block is considered as a duplication.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS, | |||||
type = Property.Type.INTEGER), | |||||
@Property( | |||||
key = CoreProperties.CPD_IGNORE_LITERALS_PROPERTY, | |||||
defaultValue = CoreProperties.CPD_IGNORE_LITERALS_DEFAULT_VALUE + "", | |||||
name = "Ignore literals", | |||||
description = "Deprecated property used only by the PMD CPD engine." + | |||||
" If true, PMD-CPD ignores literal value differences when evaluating a duplicate block." + | |||||
" This means that foo=\"first string\"; and foo=\"second string\"; will be seen as equivalent.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS, | |||||
type = Property.Type.BOOLEAN), | |||||
@Property( | |||||
key = CoreProperties.CPD_IGNORE_IDENTIFIERS_PROPERTY, | |||||
defaultValue = CoreProperties.CPD_IGNORE_IDENTIFIERS_DEFAULT_VALUE + "", | |||||
name = "Ignore identifiers", | |||||
description = "Deprecated property used only by the PMD CPD engine." + | |||||
" Similar to 'Ignore literals' but for identifiers; i.e., variable names, methods names, and so forth.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_DUPLICATIONS, | |||||
type = Property.Type.BOOLEAN) | |||||
}) | }) | ||||
public class CpdPlugin extends SonarPlugin { | |||||
public final class CpdPlugin extends SonarPlugin { | |||||
public List getExtensions() { | public List getExtensions() { | ||||
return Arrays.asList(CpdSensor.class, SumDuplicationsDecorator.class, DuplicationDensityDecorator.class, | return Arrays.asList(CpdSensor.class, SumDuplicationsDecorator.class, DuplicationDensityDecorator.class, | ||||
IndexFactory.class, | |||||
SonarEngine.class, | |||||
PmdEngine.class, | |||||
SonarBridgeEngine.class); | |||||
IndexFactory.class, | |||||
SonarEngine.class, | |||||
PmdEngine.class, | |||||
SonarBridgeEngine.class); | |||||
} | } | ||||
} | } |
@Property(key = DbCleanerConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_WEEK, defaultValue = "4", | @Property(key = DbCleanerConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_WEEK, defaultValue = "4", | ||||
name = "Number of weeks before starting to keep only one snapshot by week", | name = "Number of weeks before starting to keep only one snapshot by week", | ||||
description = "After this number of weeks, if there are several snapshots during the same week, " | description = "After this number of weeks, if there are several snapshots during the same week, " | ||||
+ "the DbCleaner keeps the first one and fully delete the other ones.", global = true, project = true), | |||||
+ "the DbCleaner keeps the first one and fully delete the other ones.", | |||||
global = true, | |||||
project = true, | |||||
type = Property.Type.INTEGER), | |||||
@Property(key = DbCleanerConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_MONTH, defaultValue = "52", | @Property(key = DbCleanerConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_MONTH, defaultValue = "52", | ||||
name = "Number of weeks before starting to keep only one snapshot by month", | name = "Number of weeks before starting to keep only one snapshot by month", | ||||
description = "After this number of weeks, if there are several snapshots during the same month, " | description = "After this number of weeks, if there are several snapshots during the same month, " | ||||
+ "the DbCleaner keeps the first one and fully delete the other ones.", global = true, project = true), | |||||
+ "the DbCleaner keeps the first one and fully delete the other ones.", | |||||
global = true, | |||||
project = true, | |||||
type = Property.Type.INTEGER), | |||||
@Property(key = DbCleanerConstants.WEEKS_BEFORE_DELETING_ALL_SNAPSHOTS, defaultValue = "260", | @Property(key = DbCleanerConstants.WEEKS_BEFORE_DELETING_ALL_SNAPSHOTS, defaultValue = "260", | ||||
name = "Number of weeks before starting to delete all remaining snapshots", | name = "Number of weeks before starting to delete all remaining snapshots", | ||||
description = "After this number of weeks, all snapshots are fully deleted.", global = true, project = true) | |||||
description = "After this number of weeks, all snapshots are fully deleted.", | |||||
global = true, | |||||
project = true, | |||||
type = Property.Type.INTEGER) | |||||
} | } | ||||
) | ) | ||||
public final class DbCleanerPlugin extends SonarPlugin { | public final class DbCleanerPlugin extends SonarPlugin { |
@Property( | @Property( | ||||
key = DbCleanerConstants.PROPERTY_CLEAN_DIRECTORY, | key = DbCleanerConstants.PROPERTY_CLEAN_DIRECTORY, | ||||
defaultValue = "true", | defaultValue = "true", | ||||
name = "Clean history data of directories/packages") | |||||
name = "Clean history data of directories/packages", | |||||
global = true, | |||||
project = true, | |||||
module = false, | |||||
type = Property.Type.BOOLEAN) | |||||
}) | }) | ||||
public class DefaultPurgeTask implements PurgeTask { | public class DefaultPurgeTask implements PurgeTask { | ||||
private static final Logger LOG = LoggerFactory.getLogger(DefaultPurgeTask.class); | private static final Logger LOG = LoggerFactory.getLogger(DefaultPurgeTask.class); |
import java.util.List; | import java.util.List; | ||||
@Properties({ | @Properties({ | ||||
@Property( | |||||
key = CoreProperties.FINDBUGS_EFFORT_PROPERTY, | |||||
defaultValue = CoreProperties.FINDBUGS_EFFORT_DEFAULT_VALUE, | |||||
name = "Effort", | |||||
description = "Effort of the bug finders. Valid values are Min, Default and Max. Setting 'Max' increases precision but also increases " + | |||||
"memory consumption.", | |||||
project = true, module = true, global = true), | |||||
@Property( | |||||
key = CoreProperties.FINDBUGS_TIMEOUT_PROPERTY, | |||||
defaultValue = CoreProperties.FINDBUGS_TIMEOUT_DEFAULT_VALUE + "", | |||||
name = "Timeout", | |||||
description = "Specifies the amount of time, in milliseconds, that FindBugs may run before it is assumed to be hung and is terminated. " + | |||||
"The default is 600,000 milliseconds, which is ten minutes.", | |||||
project = true, module = true, global = true), | |||||
@Property( | |||||
key = FindbugsConstants.EXCLUDES_FILTERS_PROPERTY, | |||||
name = "Excludes Filters", | |||||
description = "Paths to findbugs filter-files with exclusions (comma-separated).", | |||||
project = true, module = true, global = true) }) | |||||
@Property( | |||||
key = CoreProperties.FINDBUGS_EFFORT_PROPERTY, | |||||
defaultValue = CoreProperties.FINDBUGS_EFFORT_DEFAULT_VALUE, | |||||
name = "Effort", | |||||
description = "Effort of the bug finders. Valid values are Min, Default and Max. Setting 'Max' increases precision but also increases " + | |||||
"memory consumption.", | |||||
project = true, | |||||
module = true, | |||||
global = true), | |||||
@Property( | |||||
key = CoreProperties.FINDBUGS_TIMEOUT_PROPERTY, | |||||
defaultValue = CoreProperties.FINDBUGS_TIMEOUT_DEFAULT_VALUE + "", | |||||
name = "Timeout", | |||||
description = "Specifies the amount of time, in milliseconds, that FindBugs may run before it is assumed to be hung and is terminated. " + | |||||
"The default is 600,000 milliseconds, which is ten minutes.", | |||||
project = true, | |||||
module = true, | |||||
global = true, | |||||
type = Property.Type.INTEGER), | |||||
@Property( | |||||
key = FindbugsConstants.EXCLUDES_FILTERS_PROPERTY, | |||||
name = "Excludes Filters", | |||||
description = "Paths to findbugs filter-files with exclusions (comma-separated).", | |||||
project = true, module = true, global = true)}) | |||||
public class FindbugsPlugin extends SonarPlugin { | public class FindbugsPlugin extends SonarPlugin { | ||||
public List<Class<? extends Extension>> getExtensions() { | public List<Class<? extends Extension>> getExtensions() { |
download_verb=Download | download_verb=Download | ||||
edit=Edit | edit=Edit | ||||
events=Events | events=Events | ||||
false=False | |||||
file=File | file=File | ||||
files=Files | files=Files | ||||
filter_verb=Filter | filter_verb=Filter | ||||
title=Title | title=Title | ||||
to=To | to=To | ||||
treemap=Treemap | treemap=Treemap | ||||
true=True | |||||
update_verb=Update | update_verb=Update | ||||
updated=Updated | updated=Updated | ||||
unfollow=Unfollow | unfollow=Unfollow | ||||
dependencies.page=Dependencies | dependencies.page=Dependencies | ||||
duplications.page=Duplications | duplications.page=Duplications | ||||
email_configuration.page=Email Settings | email_configuration.page=Email Settings | ||||
encryption.page=Settings Encryption | |||||
event_categories.page=Event Categories | event_categories.page=Event Categories | ||||
filters.page=Filters | filters.page=Filters | ||||
global_roles.page=Global Roles | global_roles.page=Global Roles | ||||
#------------------------------------------------------------------------------ | #------------------------------------------------------------------------------ | ||||
settings.save_category=Save {0} Settings | settings.save_category=Save {0} Settings | ||||
property.category.email=Email | property.category.email=Email | ||||
property.category.encryption=Encryption | |||||
property.category.general=General | property.category.general=General | ||||
property.category.security=Security | property.category.security=Security | ||||
property.category.java=Java | property.category.java=Java |
import java.util.List; | import java.util.List; | ||||
@Properties({ | @Properties({ | ||||
@Property(key = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_PROPERTY, | |||||
defaultValue = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_DEFAULT_VALUE | |||||
+ "", | |||||
name = "Separate accessors", | |||||
description = "Flag whether Squid should separate accessors (getters/setters) from methods. " + | |||||
"In that case, accessors are not counted in metrics such as complexity or API documentation.", | |||||
project = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_JAVA), | |||||
@Property(key = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION, | |||||
defaultValue = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION_DEFAULT_VALUE, | |||||
name = "List of fields to exclude from LCOM4 computation", | |||||
description = "Some fields should not be taken into account when computing LCOM4 measure as they " + | |||||
"unexpectedly and artificially decrease the LCOM4 measure. " | |||||
+ "The best example is a logger used by all methods of a class. " + | |||||
"All field names to exclude from LCOM4 computation must be separated by a comma.", | |||||
project = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_JAVA), | |||||
@Property( | |||||
key = CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY, | |||||
defaultValue = "" + CoreProperties.DESIGN_SKIP_DESIGN_DEFAULT_VALUE, | |||||
name = "Skip design analysis", | |||||
project = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_JAVA) | |||||
@Property(key = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_PROPERTY, | |||||
defaultValue = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_DEFAULT_VALUE + "", | |||||
name = "Separate accessors", | |||||
description = "Flag whether Squid should separate accessors (getters/setters) from methods. " + | |||||
"In that case, accessors are not counted in metrics such as complexity or API documentation.", | |||||
project = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_JAVA, | |||||
type = Property.Type.BOOLEAN), | |||||
@Property(key = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION, | |||||
defaultValue = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION_DEFAULT_VALUE, | |||||
name = "List of fields to exclude from LCOM4 computation", | |||||
description = "Some fields should not be taken into account when computing LCOM4 measure as they " + | |||||
"unexpectedly and artificially decrease the LCOM4 measure. " | |||||
+ "The best example is a logger used by all methods of a class. " + | |||||
"All field names to exclude from LCOM4 computation must be separated by a comma.", | |||||
project = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_JAVA), | |||||
@Property( | |||||
key = CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY, | |||||
defaultValue = "" + CoreProperties.DESIGN_SKIP_DESIGN_DEFAULT_VALUE, | |||||
name = "Skip design analysis", | |||||
project = true, | |||||
global = true, | |||||
category = CoreProperties.CATEGORY_JAVA, | |||||
type = Property.Type.BOOLEAN) | |||||
}) | }) | ||||
public final class SquidPlugin extends SonarPlugin { | public final class SquidPlugin extends SonarPlugin { | ||||
public List getExtensions() { | public List getExtensions() { | ||||
return Arrays.asList(SquidSensor.class, SquidRuleRepository.class, JavaSourceImporter.class, | return Arrays.asList(SquidSensor.class, SquidRuleRepository.class, JavaSourceImporter.class, | ||||
ClassComplexityDistributionBuilder.class, FunctionComplexityDistributionBuilder.class, ClassesDecorator.class, | |||||
ChidamberKemererDistributionBuilder.class, FunctionsDecorator.class); | |||||
ClassComplexityDistributionBuilder.class, FunctionComplexityDistributionBuilder.class, ClassesDecorator.class, | |||||
ChidamberKemererDistributionBuilder.class, FunctionsDecorator.class); | |||||
} | } | ||||
} | } |
@Target(ElementType.TYPE) | @Target(ElementType.TYPE) | ||||
public @interface Property { | public @interface Property { | ||||
/** | |||||
* @since 2.15 | |||||
*/ | |||||
public static enum Type { | |||||
STRING, TEXT, PASSWORD, BOOLEAN, INTEGER, FLOAT, SINGLE_SELECT_LIST | |||||
} | |||||
/** | /** | ||||
* Unique key within all plugins. It's recommended to prefix the key by 'sonar.' and the plugin name. Examples : | * Unique key within all plugins. It's recommended to prefix the key by 'sonar.' and the plugin name. Examples : | ||||
* 'sonar.cobertura.reportPath' and 'sonar.cpd.minimumTokens'. | * 'sonar.cobertura.reportPath' and 'sonar.cpd.minimumTokens'. | ||||
* Is the property displayed in global settings page ? | * Is the property displayed in global settings page ? | ||||
*/ | */ | ||||
boolean global() default true; | boolean global() default true; | ||||
/** | |||||
* @since 2.15 | |||||
*/ | |||||
Type type() default Type.STRING; | |||||
/** | |||||
* Options for *_LIST types | |||||
* | |||||
* @since 2.15 | |||||
*/ | |||||
String[] options() default {}; | |||||
} | } |
* @since 2.4 | * @since 2.4 | ||||
*/ | */ | ||||
@Properties({ | @Properties({ | ||||
@Property( | |||||
key = "sonar.updatecenter.activate", | |||||
defaultValue = "true", | |||||
name = "Enable Update Center", | |||||
project = false, | |||||
global = false, // hidden from UI | |||||
category = "Update Center"), | |||||
@Property( | |||||
key = UpdateCenterClient.URL_PROPERTY, | |||||
defaultValue = "http://update.sonarsource.org/update-center.properties", | |||||
name = "Update Center URL", | |||||
project = false, | |||||
global = false, // hidden from UI | |||||
category = "Update Center") | |||||
@Property( | |||||
key = "sonar.updatecenter.activate", | |||||
defaultValue = "true", | |||||
name = "Enable Update Center", | |||||
project = false, | |||||
global = false, // hidden from UI | |||||
category = "Update Center", | |||||
type = Property.Type.BOOLEAN), | |||||
@Property( | |||||
key = UpdateCenterClient.URL_PROPERTY, | |||||
defaultValue = "http://update.sonarsource.org/update-center.properties", | |||||
name = "Update Center URL", | |||||
project = false, | |||||
global = false, // hidden from UI | |||||
category = "Update Center") | |||||
}) | }) | ||||
public class UpdateCenterClient implements ServerComponent { | public class UpdateCenterClient implements ServerComponent { | ||||
<li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"> | <li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"> | ||||
<a href="<%= ApplicationController.root_context -%>/updatecenter"><%= message('update_center.page') -%></a></li> | <a href="<%= ApplicationController.root_context -%>/updatecenter"><%= message('update_center.page') -%></a></li> | ||||
<% end %> | <% end %> | ||||
<li class="<%= 'selected' if request.request_uri.include?('/encryption') -%>"><a href="<%= ApplicationController.root_context -%>/encryption"><%= message('encryption.page') -%></a></li> | |||||
<% end %> | <% end %> | ||||
<% end %> | <% end %> |
<p class="marginbottom10"><%= message('server_id_configuration.organisation.desc') -%></p> | <p class="marginbottom10"><%= message('server_id_configuration.organisation.desc') -%></p> | ||||
<p> | <p> | ||||
<input type="text" name="organisation" value="<%= @organisation -%>"/> | |||||
<input type="text" name="organisation" value="<%= @organisation -%>" size="50"/> | |||||
</p> | </p> | ||||
</td> | </td> | ||||
</tr> | </tr> |
} | } | ||||
</style> | </style> | ||||
<script type="text/javascript"> | <script type="text/javascript"> | ||||
function replaceTextField(span_id, key) { | |||||
var text_field_value = $F(key); | |||||
var text_area = '<textarea cols="100" id="' + key + '" name="' + key + '" rows="10">' + text_field_value + '</textarea>'; | |||||
$(span_id).replace(text_area); | |||||
function enlargeTextInput(propertyKey) { | |||||
var eltId = 'input_' + propertyKey; | |||||
var textValue = $F(eltId); | |||||
var textArea = '<textarea class="width100" id="' + propertyKey + '" name="' + propertyKey + '" rows="10" id="input_' + propertyKey + '">' + textValue + '</textarea>'; | |||||
$(eltId).parentNode.replace(textArea); | |||||
} | } | ||||
</script> | </script> | ||||
<div id="plugins"> | <div id="plugins"> | ||||
if @properties_per_category[@category] | if @properties_per_category[@category] | ||||
@properties_per_category[@category].each do |property| | @properties_per_category[@category].each do |property| | ||||
value = Property.value(property.key(), (@project ? @project.id : nil), '') | value = Property.value(property.key(), (@project ? @project.id : nil), '') | ||||
# for backward-compatibility with properties that do not define the type TEXT | |||||
property_type = value.include?("\n") ? 'TEXT' : property.type | |||||
%> | %> | ||||
<tr class="<%= cycle('even', 'odd', :name => 'properties') -%>"> | <tr class="<%= cycle('even', 'odd', :name => 'properties') -%>"> | ||||
<td style="padding: 10px"> | <td style="padding: 10px"> | ||||
if desc.present? %> | if desc.present? %> | ||||
<p class="marginbottom10"><%= desc -%></p> | <p class="marginbottom10"><%= desc -%></p> | ||||
<% end %> | <% end %> | ||||
<div><%= render :partial => "settings/type_#{property_type}", :locals => {:property => property, :value => value} -%></div> | |||||
<p> | <p> | ||||
<% span_id = "text_" + property.key().gsub('.', '_') %> | |||||
<% textfield = text_field_tag property.key(), value, :size => '20' %> | |||||
<% textfield += link_to_function(image_tag("zoom.png"), "replaceTextField('#{span_id}', '#{property.key()}')", :id => "toggle_text", :class => 'nolink') %> | |||||
<% textarea = text_area_tag property.key(), value, :size => "100x10" %> | |||||
<span id="<%= span_id %>"><%= (value && value.length >= 50) ? textarea : textfield -%></span> | |||||
<% | <% | ||||
default_prop_value = (@project ? Property.value(property.key(), nil, property.defaultValue()) : property.defaultValue()) | default_prop_value = (@project ? Property.value(property.key(), nil, property.defaultValue()) : property.defaultValue()) | ||||
unless default_prop_value.blank? %> | unless default_prop_value.blank? %> |
<select name="<%= h property.key -%>" id="input_<%= h property.key-%>"> | |||||
<option value="" <%= 'selected' if value.blank? -%>><%= message('default') -%></option> | |||||
<option value="true" <%= 'selected' if value=='true' -%>><%= message('true') -%></option> | |||||
<option value="false" <%= 'selected' if value=='false' -%>><%= message('false') -%></option> | |||||
</select> |
<input type="text" name="<%= h property.key -%>" value="<%= h value if value -%>" size="50" id="input_<%= h property.key-%>"/> |
<input type="text" name="<%= h property.key -%>" value="<%= h value if value -%>" size="50" id="input_<%= h property.key-%>"/> |
<input type="password" name="<%= h property.key -%>" value="<%= h value if value -%>" size="50" id="input_<%= h property.key-%>"/> |
<select name="<%= h property.key -%>" id="input_<%= h property.key-%>"> | |||||
<option value=""><%= message('default') -%></option> | |||||
<% property.options.each do |option| %> | |||||
<option value="<%= h option -%>"><%= h option -%></option> | |||||
<% end %> | |||||
</select> |
<textarea rows="5" cols="80" class="width100" name="<%= h property.key -%>" id="input_<%= h property.key-%>"><%= h value if value -%></textarea> |