org.sonar.api.PropertyType Java Examples

The following examples show how to use org.sonar.api.PropertyType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PmdRulesDefinitionTest.java    From sonar-p3c-pmd with MIT License 6 votes vote down vote up
@Test
public void should_use_text_parameter_for_xpath_rule() {
  PmdRulesDefinition definition = new PmdRulesDefinition();
  RulesDefinition.Context context = new RulesDefinition.Context();
  definition.define(context);
  RulesDefinition.Repository repository = context.repository(PmdConstants.REPOSITORY_KEY);

  Rule xpathRule = Iterables.find(repository.rules(), new Predicate<Rule>() {
    @Override
    public boolean apply(Rule rule) {
      return rule.key().equals("XPathRule");
    }
  });

  assertThat(xpathRule.param("xpath").type().type()).isEqualTo(PropertyType.TEXT.name());
}
 
Example #2
Source File: TypeScriptPluginTest.java    From SonarTsPlugin with MIT License 6 votes vote down vote up
@Test
public void ruleConfigsSetting_definedAppropriately() {
    Property property = findPropertyByName(TypeScriptPlugin.SETTING_TS_RULE_CONFIGS);

    assertEquals(PropertyType.STRING, property.type());
    assertEquals("", property.defaultValue());
    assertEquals(false, property.project());
    assertEquals(true, property.global());
    assertEquals(2, property.fields().length);

    // name
    assertEquals("name", property.fields()[0].key());
    assertEquals(PropertyType.STRING, property.fields()[0].type());

    // config
    assertEquals("config", property.fields()[1].key());
    assertEquals(PropertyType.TEXT, property.fields()[1].type());
    assertEquals(120, property.fields()[1].indicativeSize());
}
 
Example #3
Source File: CheckstylePlugin.java    From sonar-checkstyle with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public List getExtensions() {
    return Arrays
            .asList(PropertyDefinition.builder(CheckstyleConstants.CHECKER_FILTERS_KEY)
                            .defaultValue(CheckstyleConstants.CHECKER_FILTERS_DEFAULT_VALUE)
                            .category(CoreProperties.CATEGORY_JAVA)
                            .subCategory(CHECKSTYLE_SUB_CATEGORY_NAME)
                            .name("Checker Filters")
                            .description(CHECKER_FILTERS_DESCRIPTION)
                            .type(PropertyType.TEXT)
                            .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE).build(),
                    PropertyDefinition.builder(CheckstyleConstants.TREEWALKER_FILTERS_KEY)
                            .defaultValue(CheckstyleConstants.TREEWALKER_FILTERS_DEFAULT_VALUE)
                            .category(CoreProperties.CATEGORY_JAVA)
                            .subCategory(CHECKSTYLE_SUB_CATEGORY_NAME)
                            .name("Treewalker Filters")
                            .description(TREEWALKER_FILTERS_DESCRIPTION)
                            .type(PropertyType.TEXT)
                            .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE).build(),
                    PropertyDefinition.builder(CheckstyleConstants.CHECKER_TAB_WIDTH)
                            .category(CoreProperties.CATEGORY_JAVA)
                            .subCategory(CHECKSTYLE_SUB_CATEGORY_NAME)
                            .name("Tab Width")
                            .description(CHECKER_TAB_WIDTH_DESCRIPTION)
                            .type(PropertyType.INTEGER)
                            .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
                            .build(),
                    PropertyDefinition.builder(CheckstyleConfiguration.PROPERTY_GENERATE_XML)
                            .defaultValue("false").category(CoreProperties.CATEGORY_JAVA)
                            .subCategory(CHECKSTYLE_SUB_CATEGORY_NAME)
                            .name("Generate XML Report").type(PropertyType.BOOLEAN).hidden()
                            .build(),

                    CheckstyleSensor.class, CheckstyleConfiguration.class,
                    CheckstyleExecutor.class, CheckstyleAuditListener.class,
                    CheckstyleProfileExporter.class, CheckstyleProfileImporter.class,
                    CheckstyleRulesDefinition.class);
}
 
Example #4
Source File: TypeScriptPluginTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void tsLintPathSetting_definedAppropriately() {
    Property property = findPropertyByName(TypeScriptPlugin.SETTING_TS_LINT_PATH);

    assertEquals(PropertyType.STRING, property.type());
    assertEquals("", property.defaultValue());
    assertEquals(true, property.project());
    assertEquals(true, property.global());
}
 
Example #5
Source File: TypeScriptPluginTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void excludeTypeDefinitionFilesSetting_definedAppropriately() {
    Property property = findPropertyByName(TypeScriptPlugin.SETTING_EXCLUDE_TYPE_DEFINITION_FILES);

    assertEquals(PropertyType.BOOLEAN, property.type());
    assertEquals("true", property.defaultValue());
    assertEquals(true, property.project());
    assertEquals(false, property.global());
}
 
Example #6
Source File: TypeScriptPluginTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void lcovReportPathSetting_definedAppropriately() {
    Property property = findPropertyByName(TypeScriptPlugin.SETTING_LCOV_REPORT_PATH);

    assertEquals(PropertyType.STRING, property.type());
    assertEquals("", property.defaultValue());
    assertEquals(true, property.project());
    assertEquals(false, property.global());
}
 
Example #7
Source File: TypeScriptPluginTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void forceZeroCoverageSetting_definedAppropriately() {
    Property property = findPropertyByName(TypeScriptPlugin.SETTING_FORCE_ZERO_COVERAGE);

    assertEquals(PropertyType.BOOLEAN, property.type());
    assertEquals("false", property.defaultValue());
    assertEquals(true, property.project());
    assertEquals(false, property.global());
}
 
Example #8
Source File: TypeScriptPluginTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void tsLintTimeoutSettings_definedAppropriately() {
    Property property = findPropertyByName(TypeScriptPlugin.SETTING_TS_LINT_TIMEOUT);

    assertEquals(PropertyType.INTEGER, property.type());
    assertEquals("60000", property.defaultValue());
    assertEquals(true, property.project());
    assertEquals(false, property.global());
}
 
Example #9
Source File: TypeScriptPluginTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void rulesDirSetting_definedAppropriately() {
    Property property = findPropertyByName(TypeScriptPlugin.SETTING_TS_LINT_RULES_DIR);

    assertEquals(PropertyType.STRING, property.type());
    assertEquals("", property.defaultValue());
    assertEquals(true, property.project());
    assertEquals(false, property.global());
}
 
Example #10
Source File: CommunityBranchPlugin.java    From sonarqube-community-branch-plugin with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void load(CoreExtension.Context context) {
    if (SonarQubeSide.COMPUTE_ENGINE == context.getRuntime().getSonarQubeSide()) {
        context.addExtensions(CommunityReportAnalysisComponentProvider.class, CommunityBranchEditionProvider.class);
    } else if (SonarQubeSide.SERVER == context.getRuntime().getSonarQubeSide()) {
        context.addExtensions(CommunityBranchFeatureExtension.class, CommunityBranchSupportDelegate.class,

                              AlmSettingsWs.class, CountBindingAction.class, DeleteAction.class,
                              DeleteBindingAction.class, ListAction.class, ListDefinitionsAction.class,
                              GetBindingAction.class,

                              CreateGithubAction.class, SetGithubBindingAction.class, UpdateGithubAction.class,

                              CreateAzureAction.class, SetAzureBindingAction.class, UpdateAzureAction.class,

                              CreateBitbucketAction.class, SetBitbucketBindingAction.class,
                              UpdateBitbucketAction.class,

                              CreateGitlabAction.class, SetGitlabBindingAction.class, UpdateGitlabAction.class,

            /* org.sonar.db.purge.PurgeConfiguration uses the value for the this property if it's configured, so it only
            needs to be specified here, but doesn't need any additional classes to perform the relevant purge/cleanup
            */
                              PropertyDefinition
                                      .builder(PurgeConstants.DAYS_BEFORE_DELETING_INACTIVE_BRANCHES_AND_PRS)
                                      .name("Number of days before purging inactive short living branches")
                                      .description(
                                              "Short living branches are permanently deleted when there are no analysis for the configured number of days.")
                                      .category(CoreProperties.CATEGORY_HOUSEKEEPING)
                                      .subCategory(CoreProperties.SUBCATEGORY_GENERAL).defaultValue("30")
                                      .type(PropertyType.INTEGER).build()


                             );

    }

    if (SonarQubeSide.COMPUTE_ENGINE == context.getRuntime().getSonarQubeSide() ||
        SonarQubeSide.SERVER == context.getRuntime().getSonarQubeSide()) {
        context.addExtensions(PropertyDefinition.builder(IMAGE_URL_BASE)
                                      .category(CoreProperties.CATEGORY_GENERAL)
                                      .subCategory(CoreProperties.SUBCATEGORY_GENERAL)
                                      .onQualifiers(Qualifiers.APP)
                                      .name("Images base URL")
                                      .description("Base URL used to load the images for the PR comments (please use this only if images are not displayed properly).")
                                      .type(PropertyType.STRING)
                                      .build());

    }
}
 
Example #11
Source File: LicenseCheckPlugin.java    From sonarqube-licensecheck with Apache License 2.0 4 votes vote down vote up
private List<?> getExtensions()
{
    return Arrays.asList(
        ValidateLicenses.class,
        LicenseCheckSensor.class,
        LicenseCheckMetrics.class,
        LicenseCheckPageDefinition.class,
        LicenseCheckRulesDefinition.class,
        LicenseService.class,
        LicenseSettingsService.class,
        LicenseWs.class,
        MavenDependencyService.class,
        MavenDependencySettingsService.class,
        MavenDependencyWs.class,
        MavenLicenseService.class,
        MavenLicenseSettingsService.class,
        MavenLicenseWs.class,
        ProjectLicenseService.class,
        ProjectLicenseSettingsService.class,
        ProjectLicenseWs.class,
        PropertyDefinition.builder(LicenseCheckPropertyKeys.LICENSE_KEY)
            .type(PropertyType.TEXT)
            .build(),
        PropertyDefinition.builder(LicenseCheckPropertyKeys.ALLOWED_DEPENDENCIES_KEY)
            .type(PropertyType.TEXT)
            .build(),
        PropertyDefinition.builder(LicenseCheckPropertyKeys.LICENSE_REGEX)
            .type(PropertyType.TEXT)
            .build(),
        PropertyDefinition.builder(LicenseCheckPropertyKeys.PROJECT_LICENSE_KEY)
            .type(PropertyType.TEXT)
            .build(),
        PropertyDefinition.builder(LicenseCheckPropertyKeys.NPM_RESOLVE_TRANSITIVE_DEPS)
            .type(PropertyType.BOOLEAN)
            .build(),
        PropertyDefinition.builder(LicenseCheckPropertyKeys.ACTIVATION_KEY)
            .category("License Check")
            .name("Activate")
            .description("Activate license check")
            .type(PropertyType.BOOLEAN)
            .defaultValue("true")
            .build());
}
 
Example #12
Source File: FlowLanguageProperties.java    From sonar-flow-plugin with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Get the list of language properties.
 * @return list of properties
 */
public static List<Object> getProperties() {
  ImmutableList.Builder<Object> props = ImmutableList.builder();
  props.add(
      PropertyDefinition.builder(FLOW_FILE_SUFFIXES_KEY).defaultValue(FLOW_FILE_SUFFIXES_DEFVALUE)
          .name("Flow file suffixes")
          .type(PropertyType.STRING)
          .category(FLOW_CATEGORY)
          .subCategory(FLOW_SUBCATEGORY_FLOW)
          .description("Comma-separated list extensions for flow files to analyze.")
          .onQualifiers(Qualifiers.PROJECT).build())
      .add(
      PropertyDefinition.builder(NODE_FILE_SUFFIXES_KEY).defaultValue(NODE_FILE_SUFFIXES_DEFVALUE)
          .name("Node file suffixes")
          .type(PropertyType.STRING)
          .category(FLOW_CATEGORY)
          .subCategory(FLOW_SUBCATEGORY_NODE)
          .description("Comma-separated list of extensions for node files to analyze.")
          .onQualifiers(Qualifiers.PROJECT).build())
      .add(
      PropertyDefinition.builder(FLOW_FILE_FILTER_KEY).defaultValue(FLOW_FILE_FILTER_DEFVALUE)
          .name("Flow file pattern")
          .type(PropertyType.REGULAR_EXPRESSION)
          .category(FLOW_CATEGORY)
          .subCategory(FLOW_SUBCATEGORY_FLOW)
          .description("Regex pattern for flow files to analyze.")
          .onQualifiers(Qualifiers.PROJECT).build())
      .add(
      PropertyDefinition.builder(NODE_FILE_FILTER_KEY).defaultValue(NODE_FILE_FILTER_DEFVALUE)
          .name("Node file patterns")
          .type(PropertyType.REGULAR_EXPRESSION)
          .category(FLOW_CATEGORY)
          .subCategory(FLOW_SUBCATEGORY_NODE)
          .description("Regex patterns for node files to analyze.")
          .onQualifiers(Qualifiers.PROJECT).build(),
      PropertyDefinition.builder(IGNORE_TOPLEVEL_KEY).defaultValue(IGNORE_TOPLEVEL_DEFVALUE)
          .name("Ignore top-level services")
          .type(PropertyType.BOOLEAN)
          .category(FLOW_CATEGORY)
          .subCategory(FLOW_SUBCATEGORY_CHECKS)
          .description("Ignore top-level service checks")
          .onQualifiers(Qualifiers.PROJECT).build())
      .add(
      PropertyDefinition.builder(FAIL_ON_SCANERROR).defaultValue(FAIL_ON_SCANERROR_DEFVALUE)
          .name("Fail on scan error")
          .type(PropertyType.BOOLEAN)
          .category(FLOW_CATEGORY)
          .subCategory(FLOW_SUBCATEGORY_SCANNER)
          .description("Scanning process fails when a scanning a single file fails")
          .onQualifiers(Qualifiers.PROJECT).build());
  return props.build();
}
 
Example #13
Source File: GoogleSettings.java    From sonar-auth-google with Apache License 2.0 4 votes vote down vote up
public static List<PropertyDefinition> definitions() {
  int index = 1;
  return Arrays.asList(
    PropertyDefinition.builder(ENABLED)
      .name("Enabled")
      .description("Enable Google users to login. Value is ignored if client ID and secret are not defined.")
      .category(CATEGORY)
      .subCategory(SUBCATEGORY)
      .type(PropertyType.BOOLEAN)
      .defaultValue(String.valueOf(false))
      .index(index++)
      .build(),
    PropertyDefinition.builder(CONSUMER_KEY)
      .name("OAuth client ID")
      .description("The Client ID provided by Google when registering the application.")
      .category(CATEGORY)
      .subCategory(SUBCATEGORY)
      .index(index++)
      .build(),
    PropertyDefinition.builder(CONSUMER_SECRET)
      .name("OAuth Client Secret")
      .description("Client Secret provided by Google when registering the application.")
      .category(CATEGORY)
      .subCategory(SUBCATEGORY)
      .index(index++)
      .build(),
    PropertyDefinition.builder(ALLOW_USERS_TO_SIGN_UP)
      .name("Allow users to sign-up")
      .description("Allow new users to authenticate. When set to 'false', only existing users will be able to authenticate to the server.")
      .category(CATEGORY)
      .subCategory(SUBCATEGORY)
      .type(PropertyType.BOOLEAN)
      .defaultValue(String.valueOf(true))
      .index(index++)
      .build(),
    PropertyDefinition.builder(LOGIN_STRATEGY)
      .name("Login generation strategy")
      .description(format("When the login strategy is set to '%s', the user's login will be auto-generated the first time so that it is unique. " +
                      "When the login strategy is set to '%s', the user's login will be the Google login.",
              LOGIN_STRATEGY_UNIQUE, LOGIN_STRATEGY_PROVIDER_LOGIN))
      .category(CATEGORY)
      .subCategory(SUBCATEGORY)
      .type(SINGLE_SELECT_LIST)
      .defaultValue(LOGIN_STRATEGY_DEFAULT_VALUE)
      .options(LOGIN_STRATEGY_UNIQUE, LOGIN_STRATEGY_PROVIDER_LOGIN)
      .index(index++)
      .build(),
    PropertyDefinition.builder(LIMIT_DOMAIN)
      .name("Allowed Domain")
      .description("When set, this will only allow users from the specified GApps domain to authenticate")
      .category(CATEGORY)
      .subCategory(SUBCATEGORY)
      .index(index++)
      .build(),
    PropertyDefinition.builder(WEB_URL)
      .name("Google authentication URI")
      .description("When set, this will override the URI used to send an authentication request to Google")
      .defaultValue(DEFAULT_WEB_URL)
      .category(CATEGORY)
      .subCategory(SUBCATEGORY)
      .index(index++)
      .build()
    );
}
 
Example #14
Source File: TSQLPlugin.java    From sonar-tsql-plugin with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void define(final Context context) {
	context.addExtension(PropertyDefinition.builder(Constants.CG_APP_PATH).name("SQL Code Guard path")
			.description("Path to the sql code guard exe")
			.defaultValue("C:\\Program Files (x86)\\SqlCodeGuard\\SqlCodeGuard.Cmd.exe").type(PropertyType.STRING)
			.build());

	context.addExtension(PropertyDefinition.builder(Constants.CG_REPORT_FILE).name("SQL Code Guard results file")
			.description("SQL Code Guard results file").defaultValue(Constants.CG_REPORT_FILE_DEFAULT_VALUE)
			.type(PropertyType.STRING).build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_SKIP_CG).name("Skip SqlCodeGuard reporting")
			.description("Flag whether to skip SqlCodeGuard reporting").defaultValue("false")
			.type(PropertyType.BOOLEAN).build());

	context.addExtension(PropertyDefinition.builder(Constants.MS_REPORT_FILE)
			.name("MSBuild SQL code analysis results file").description("MSBuild SQL code analysis results file")
			.defaultValue(Constants.MS_REPORT_FILE_DEFAULT_VALUE).type(PropertyType.STRING).build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_SKIP_MS).name("Skip MSBuild reporting")
			.description("Flag whether to skip MSBuild issues reporting").defaultValue("false")
			.type(PropertyType.BOOLEAN).build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_SKIP).name("Disable plugin")
			.description("Flag whether to disable plugin").defaultValue("false").type(PropertyType.BOOLEAN)
			.build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_SKIP_CUSTOM_RULES)
			.name("Disable custom violations detection")
			.description("Flag whether to disable issues detection against custom rules").defaultValue("false")
			.type(PropertyType.BOOLEAN).build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_SKIP_CUSTOM).name("Skip custom reporting")
			.description("Flag whether to skip custom issues, syntax highlighting and other reporting")
			.defaultValue("false").type(PropertyType.BOOLEAN).build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_MAX_FILE_SIZE)
			.name("Max file size for analysis").description("Maximum file size under analysis size")
			.defaultValue("10").type(PropertyType.INTEGER).build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_CUSTOM_RULES_PATH)
			.name("Path to the custom rules path").description("A comma separated list of custom rules files/paths")
			.defaultValue("").type(PropertyType.STRING).build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_CUSTOM_RULES_PREFIX)
			.name("Custom rules file name prefix").defaultValue(".customRules").type(PropertyType.STRING).build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_SUFFIXES).name("Suffixes to analyze")
			.description("Suffixes supported by the plugin").defaultValue(".sql").type(PropertyType.STRING)
			.build());

	context.addExtension(PropertyDefinition.builder(Constants.PLUGIN_SKIP_COVERAGE).name("Skip coverage reporting")
			.description("Flag whether to skip SQLCover reporting").defaultValue("false").type(PropertyType.BOOLEAN)
			.build());

	context.addExtension(PropertyDefinition.builder(Constants.COVERAGE_FILE).name("Path to SQLCover file")
			.description("Absolute or relative path in base dir to SQLCover file")
			.defaultValue(Constants.COVERAGE_FILE_DEFAULT_VALUE).type(PropertyType.STRING).build());

	context.addExtensions(TSQLLanguage.class, TSQLQualityProfile.class);

	context.addExtensions(MsRulesDefinition.class, CustomPluginChecksRulesDefinition.class,
			CodeGuardRulesDefinition.class, CustomUserChecksRulesDefinition.class, MsIssuesLoaderSensor.class,
			CodeGuardIssuesLoaderSensor.class, CustomChecksSensor.class, CoverageSensor.class);

}
 
Example #15
Source File: EsqlPlugin.java    From sonar-esql-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void define(Context context) {
	context.addExtensions(
			EsqlLanguage.class,
			EsqlSensor.class,
			EsqlExclusionsFileFilter.class,
			EsqlRulesDefinition.class,
			EsqlProfilesDefinition.class,
			EsqlMetrics.class);

	  context.addExtensions(
		PropertyDefinition.builder(EsqlLanguage.FILE_SUFFIXES_KEY)
		        .defaultValue(EsqlLanguage.FILE_SUFFIXES_DEFVALUE)
		        .name(FILE_SUFFIXES_NAME)
		        .description(FILE_SUFFIXES_DESCRIPTION)
		        .subCategory(GENERAL)
		        .category(ESQL_CATEGORY)
		        .multiValues(true)
		        .onQualifiers(Qualifiers.PROJECT)
		        .build(),
		      
      PropertyDefinition.builder(EsqlPlugin.IGNORE_HEADER_COMMENTS)
        .defaultValue(EsqlPlugin.IGNORE_HEADER_COMMENTS_DEFAULT_VALUE.toString())
        .name("Ignore header comments")
        .description("True to not count file header comments in comment metrics.")
        .onQualifiers(Qualifiers.PROJECT)
        .subCategory(GENERAL)
        .category(ESQL_CATEGORY)
        .type(PropertyType.BOOLEAN)
        .build(),

       PropertyDefinition.builder(TRACE_PATHS_PROPERTY)
		      .defaultValue(TRACE_PATHS_DEFAULT_VALUE)
		      .category("Esql")
		      .subCategory("Trace")
		      .name("IIB trace file")
		      .description("Path to the IIB trace files containing coverage data. The path may be absolute or relative to the project base directory.")
		      .onQualifiers(Qualifiers.PROJECT)
		      .multiValues(true)
		      .build(),

	  PropertyDefinition.builder(EsqlPlugin.ESQL_EXCLUSIONS_KEY)
			  .defaultValue(ESQL_EXCLUSIONS_DEFAULT_VALUE)
			  .name("ESQL Exclusions")
			  .description("List of file path patterns to be excluded from analysis of ESQL files.")
			  .onQualifiers(Qualifiers.PROJECT)
			  .subCategory(GENERAL)
			  .multiValues(true)
			  .category(ESQL_CATEGORY)
			  .build()
		);

}
 
Example #16
Source File: GerritPlugin.java    From sonar-gerrit-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void define(Context context) {
    PropertyDefinition enabled = PropertyDefinition.builder(PropertyKey.GERRIT_ENABLED)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .type(PropertyType.BOOLEAN).defaultValue(GerritConstants.GERRIT_ENABLED_DEFAULT)
        .onQualifiers(Arrays.asList(Qualifiers.PROJECT)).index(serverBaseIndex++).build();

    PropertyDefinition scheme = PropertyDefinition.builder(PropertyKey.GERRIT_SCHEME)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .type(PropertyType.SINGLE_SELECT_LIST)
        .options(GerritConstants.SCHEME_HTTP, GerritConstants.SCHEME_HTTPS, GerritConstants.SCHEME_SSH)
        .defaultValue(GerritConstants.SCHEME_HTTP).index(serverBaseIndex++).build();

    PropertyDefinition host = PropertyDefinition.builder(PropertyKey.GERRIT_HOST)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .index(serverBaseIndex++).build();

    PropertyDefinition port = PropertyDefinition.builder(PropertyKey.GERRIT_PORT)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .type(PropertyType.INTEGER).defaultValue("80").index(serverBaseIndex++).build();

    PropertyDefinition username = PropertyDefinition.builder(PropertyKey.GERRIT_USERNAME)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .index(serverBaseIndex++).build();

    PropertyDefinition password = PropertyDefinition.builder(PropertyKey.GERRIT_PASSWORD)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .type(PropertyType.PASSWORD).index(serverBaseIndex++).build();

    PropertyDefinition sshKeyPath = PropertyDefinition.builder(PropertyKey.GERRIT_SSH_KEY_PATH)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .type(PropertyType.STRING).index(serverBaseIndex++).build();

    PropertyDefinition strictHostkey = PropertyDefinition.builder(PropertyKey.GERRIT_STRICT_HOSTKEY)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .type(PropertyType.BOOLEAN).defaultValue(GerritConstants.GERRIT_STRICT_HOSTKEY_DEFAULT)
        .index(serverBaseIndex++).build();

    PropertyDefinition authScheme = PropertyDefinition.builder(PropertyKey.GERRIT_HTTP_AUTH_SCHEME)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .type(PropertyType.SINGLE_SELECT_LIST).options(GerritConstants.AUTH_BASIC, GerritConstants.AUTH_DIGEST)
        .defaultValue(GerritConstants.AUTH_DIGEST).index(serverBaseIndex++).build();

    PropertyDefinition basePath = PropertyDefinition.builder(PropertyKey.GERRIT_BASE_PATH)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_SERVER)
        .defaultValue("/").index(serverBaseIndex++).build();

    PropertyDefinition label = PropertyDefinition.builder(PropertyKey.GERRIT_LABEL)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_REVIEW)
        .defaultValue("Code-Review").index(reviewBaseIndex++).build();

    PropertyDefinition message = PropertyDefinition.builder(PropertyKey.GERRIT_MESSAGE)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_REVIEW)
        .defaultValue("Sonar review at ${sonar.host.url}").index(reviewBaseIndex++).build();

    PropertyDefinition newIssuesOnly = PropertyDefinition.builder(PropertyKey.GERRIT_COMMENT_NEW_ISSUES_ONLY)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_REVIEW)
        .type(PropertyType.BOOLEAN).defaultValue(GerritConstants.GERRIT_COMMENT_NEW_ISSUES_ONLY)
        .onQualifiers(Arrays.asList(Qualifiers.PROJECT)).index(reviewBaseIndex++).build();

    PropertyDefinition threshold = PropertyDefinition.builder(PropertyKey.GERRIT_THRESHOLD)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_REVIEW)
        .type(PropertyType.SINGLE_SELECT_LIST)
        .options(Severity.INFO.toString(), Severity.MINOR.toString(), Severity.MAJOR.toString(),
            Severity.CRITICAL.toString(), Severity.BLOCKER.toString())
        .defaultValue(Severity.INFO.toString()).onQualifiers(Arrays.asList(Qualifiers.PROJECT))
        .index(reviewBaseIndex++).build();

    PropertyDefinition voteNoIssue = PropertyDefinition.builder(PropertyKey.GERRIT_VOTE_NO_ISSUE)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_REVIEW)
        .type(PropertyType.SINGLE_SELECT_LIST).options("+1", "+2")
        .defaultValue(GerritConstants.GERRIT_VOTE_NO_ISSUE_DEFAULT)
        .onQualifiers(Arrays.asList(Qualifiers.PROJECT)).index(reviewBaseIndex++).build();

    PropertyDefinition voteIssueBelowThreshold = PropertyDefinition
        .builder(PropertyKey.GERRIT_VOTE_ISSUE_BELOW_THRESHOLD).category(GerritConstants.GERRIT_CATEGORY)
        .subCategory(GerritConstants.GERRIT_SUBCATEGORY_REVIEW).type(PropertyType.SINGLE_SELECT_LIST)
        .options("-2", "-1", "0", "+1", "+2")
        .defaultValue(GerritConstants.GERRIT_VOTE_ISSUE_BELOW_THRESHOLD_DEFAULT)
        .onQualifiers(Arrays.asList(Qualifiers.PROJECT)).index(reviewBaseIndex++).build();

    PropertyDefinition voteIssueAboveThreshold = PropertyDefinition
        .builder(PropertyKey.GERRIT_VOTE_ISSUE_ABOVE_THRESHOLD).category(GerritConstants.GERRIT_CATEGORY)
        .subCategory(GerritConstants.GERRIT_SUBCATEGORY_REVIEW).type(PropertyType.SINGLE_SELECT_LIST)
        .options("-2", "-1", "0").defaultValue(GerritConstants.GERRIT_VOTE_ISSUE_ABOVE_THRESHOLD_DEFAULT)
        .onQualifiers(Arrays.asList(Qualifiers.PROJECT)).index(reviewBaseIndex++).build();

    PropertyDefinition issueComment = PropertyDefinition.builder(PropertyKey.GERRIT_ISSUE_COMMENT)
        .category(GerritConstants.GERRIT_CATEGORY).subCategory(GerritConstants.GERRIT_SUBCATEGORY_REVIEW)
        .defaultValue(
            "[${issue.isNew}] New: ${issue.ruleKey} Severity: ${issue.severity}, Message: ${issue.message}")
        .index(reviewBaseIndex++).build();

    context.addExtensions(Arrays.asList(GerritConfiguration.class, GerritConnectorFactory.class,
        GerritFacadeFactory.class, GerritInitializer.class, GerritProjectBuilder.class, GerritPostJob.class,
        enabled, scheme, host, port, username, password, authScheme,
        basePath, sshKeyPath, strictHostkey, label, message, newIssuesOnly, threshold, voteNoIssue,
        voteIssueBelowThreshold, voteIssueAboveThreshold, issueComment));
}