]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3644 Move 'Exclusions' category to 'Files' subcategory
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 11 Sep 2013 09:30:01 +0000 (11:30 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 11 Sep 2013 09:33:08 +0000 (11:33 +0200)
Migrate file related exclusions configuration to PropertyDefinition API
Introduce 'exclusions.files' subcategory

plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java

index 3f25e46fb09015641737daf357b2c766727e09da..aa252eb0fdbd3da11a0d89a663545dfadb56ba86 100644 (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());
+  }
 }
index 35da9dab6cb21c45b39b693f1e45f9cf582a3b75..bc5fafc667b462bd2ca7ae8e2f6b4feb3ff256ca 100644 (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>\
index 027b5d9a4e89ed2fa981cd9ce004dcbc3c28c277..514ecb2a3721271a3b63f069844bf21f1cf925e4 100644 (file)
@@ -72,6 +72,11 @@ public interface CoreProperties {
    */
   String CATEGORY_EXCLUSIONS = "exclusions";
 
+  /**
+   * @since 4.0
+   */
+  String SUBCATEGORY_FILES_EXCLUSIONS = "files";
+
   /**
    * @since 3.7
    */