Browse Source

SONAR-3644 Move 'Exclusions' category to 'Files' subcategory

Migrate file related exclusions configuration to PropertyDefinition API
Introduce 'exclusions.files' subcategory
tags/4.0
Jean-Baptiste Lievremont 10 years ago
parent
commit
56dc977f3e

+ 57
- 47
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java View File

@@ -19,6 +19,9 @@
*/
package org.sonar.plugins.core;

import org.sonar.api.resources.Qualifiers;

import org.sonar.api.config.PropertyDefinition;
import com.google.common.collect.ImmutableList;
import org.sonar.api.CoreProperties;
import org.sonar.api.Properties;
@@ -180,45 +183,6 @@ import java.util.List;
project = false,
global = true,
category = CoreProperties.CATEGORY_GENERAL),
@Property(
key = CoreProperties.PROJECT_INCLUSIONS_PROPERTY,
name = "Source File Inclusions",
project = true,
global = true,
multiValues = true,
category = CoreProperties.CATEGORY_EXCLUSIONS),
@Property(
key = CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY,
name = "Test File Inclusions",
project = true,
global = true,
multiValues = true,
category = CoreProperties.CATEGORY_EXCLUSIONS),
@Property(
key = CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY,
name = "Global Source File Exclusions",
multiValues = true,
category = CoreProperties.CATEGORY_EXCLUSIONS),
@Property(
key = CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY,
name = "Global Test File Exclusions",
multiValues = true,
category = CoreProperties.CATEGORY_EXCLUSIONS,
defaultValue = CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT),
@Property(
key = CoreProperties.PROJECT_EXCLUSIONS_PROPERTY,
name = "Source File Exclusions",
project = true,
global = true,
multiValues = true,
category = CoreProperties.CATEGORY_EXCLUSIONS),
@Property(
key = CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY,
name = "Test File Exclusions",
project = true,
global = true,
multiValues = true,
category = CoreProperties.CATEGORY_EXCLUSIONS),
@Property(
key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY,
defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE,
@@ -229,14 +193,6 @@ import java.util.List;
global = true,
category = CoreProperties.CATEGORY_SECURITY,
type = PropertyType.BOOLEAN),
@Property(
key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY,
name = "Exclude modules",
description = "Maven artifact ids of modules to exclude.",
project = true,
global = false,
multiValues = true,
category = CoreProperties.CATEGORY_EXCLUSIONS),
@Property(
key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY,
defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE,
@@ -528,8 +484,62 @@ public final class CorePlugin extends SonarPlugin {
NewAlerts.class,
NewAlerts.newMetadata());

extensions.addAll(getPropertyDefinitions());
extensions.addAll(IgnoreIssuesPlugin.getExtensions());

return extensions.build();
}

private static List<PropertyDefinition> getPropertyDefinitions() {
return ImmutableList.of(
PropertyDefinition.builder(CoreProperties.PROJECT_INCLUSIONS_PROPERTY)
.name("Source File Inclusions")
.multiValues(true)
.category(CoreProperties.CATEGORY_EXCLUSIONS)
.subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
.onQualifiers(Qualifiers.PROJECT)
.build(),
PropertyDefinition.builder(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY)
.name("Test File Inclusions")
.multiValues(true)
.category(CoreProperties.CATEGORY_EXCLUSIONS)
.subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
.onQualifiers(Qualifiers.PROJECT)
.build(),
PropertyDefinition.builder(CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY)
.name("Global Source File Exclusions")
.multiValues(true)
.category(CoreProperties.CATEGORY_EXCLUSIONS)
.subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
.build(),
PropertyDefinition.builder(CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY)
.name("Global Test File Exclusions")
.multiValues(true)
.category(CoreProperties.CATEGORY_EXCLUSIONS)
.subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
.defaultValue(CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT)
.build(),
PropertyDefinition.builder(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY)
.name("Source File Exclusions")
.multiValues(true)
.category(CoreProperties.CATEGORY_EXCLUSIONS)
.subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
.onQualifiers(Qualifiers.PROJECT)
.build(),
PropertyDefinition.builder(CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY)
.name("Test File Exclusions")
.multiValues(true)
.category(CoreProperties.CATEGORY_EXCLUSIONS)
.subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
.onQualifiers(Qualifiers.PROJECT)
.build(),
PropertyDefinition.builder(CoreProperties.CORE_SKIPPED_MODULES_PROPERTY)
.name("Exclude Modules")
.description("Maven artifact ids of modules to exclude.")
.multiValues(true)
.category(CoreProperties.CATEGORY_EXCLUSIONS)
.subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
.onlyOnQualifiers(Qualifiers.PROJECT)
.build());
}
}

+ 3
- 2
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties View File

@@ -723,8 +723,9 @@ property.sonar.global.exclusions.name=Global Source File Exclusions
property.sonar.global.exclusions.description=Patterns used to exclude some source files from analysis. They apply to every project and cannot be overridden.
property.sonar.global.test.exclusions.name=Global Test File Exclusions
property.sonar.global.test.exclusions.description=Patterns used to exclude some test files from analysis. They apply to every project and cannot be overridden.
property.category.exclusions.description=Configure which source code and tests you want to be omitted from analysis. Most of these parameters can also be configured at individual project level in each application's project settings.
category.exclusions.help=<h2>Wildcards</h2>\
property.category.exclusions.files=Files
property.category.exclusions.files.description=Configure which source code and tests you want to be omitted from analysis. Most of these parameters can also be configured at individual project level in each application's project settings.
category.exclusions.files.help=<h2>Wildcards</h2>\
<p>Following rules are applied:</p>\
<table class="data">\
<thead><tr><th colspan="2"></th></tr></thead>\

+ 5
- 0
sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java View File

@@ -72,6 +72,11 @@ public interface CoreProperties {
*/
String CATEGORY_EXCLUSIONS = "exclusions";

/**
* @since 4.0
*/
String SUBCATEGORY_FILES_EXCLUSIONS = "files";

/**
* @since 3.7
*/

Loading…
Cancel
Save