From 56dc977f3e8f02cda5d75e7484bd83bffc84fa32 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Wed, 11 Sep 2013 11:30:01 +0200 Subject: [PATCH] SONAR-3644 Move 'Exclusions' category to 'Files' subcategory Migrate file related exclusions configuration to PropertyDefinition API Introduce 'exclusions.files' subcategory --- .../org/sonar/plugins/core/CorePlugin.java | 104 ++++++++++-------- .../resources/org/sonar/l10n/core.properties | 5 +- .../java/org/sonar/api/CoreProperties.java | 5 + 3 files changed, 65 insertions(+), 49 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java index 3f25e46fb09..aa252eb0fdb 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java @@ -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 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()); + } } diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index 35da9dab6cb..bc5fafc667b 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -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=

Wildcards

\ +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=

Wildcards

\

Following rules are applied:

\ \ \ diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java index 027b5d9a4e8..514ecb2a372 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java @@ -72,6 +72,11 @@ public interface CoreProperties { */ String CATEGORY_EXCLUSIONS = "exclusions"; + /** + * @since 4.0 + */ + String SUBCATEGORY_FILES_EXCLUSIONS = "files"; + /** * @since 3.7 */ -- 2.39.5