]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4656 Display sonar.includedModules property in configuration
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 11 Sep 2013 13:12:13 +0000 (15:12 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 11 Sep 2013 13:14:09 +0000 (15:14 +0200)
Add core configuration constant for included modules
Declare property in core configuration block
Set indexes on configuration properties

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-batch/src/main/java/org/sonar/batch/scan/ProjectExclusions.java
sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java

index aa252eb0fdbd3da11a0d89a663545dfadb56ba86..4b32a973eb356bdef21b7cafdc86dec5eeee7279 100644 (file)
@@ -498,6 +498,7 @@ public final class CorePlugin extends SonarPlugin {
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .onQualifiers(Qualifiers.PROJECT)
+        .index(3)
         .build(),
       PropertyDefinition.builder(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY)
         .name("Test File Inclusions")
@@ -505,12 +506,14 @@ public final class CorePlugin extends SonarPlugin {
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .onQualifiers(Qualifiers.PROJECT)
+        .index(5)
         .build(),
       PropertyDefinition.builder(CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY)
         .name("Global Source File Exclusions")
         .multiValues(true)
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
+        .index(0)
         .build(),
       PropertyDefinition.builder(CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY)
         .name("Global Test File Exclusions")
@@ -518,6 +521,7 @@ public final class CorePlugin extends SonarPlugin {
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .defaultValue(CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT)
+        .index(1)
         .build(),
       PropertyDefinition.builder(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY)
         .name("Source File Exclusions")
@@ -525,6 +529,7 @@ public final class CorePlugin extends SonarPlugin {
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .onQualifiers(Qualifiers.PROJECT)
+        .index(2)
         .build(),
       PropertyDefinition.builder(CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY)
         .name("Test File Exclusions")
@@ -532,6 +537,7 @@ public final class CorePlugin extends SonarPlugin {
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .onQualifiers(Qualifiers.PROJECT)
+        .index(4)
         .build(),
       PropertyDefinition.builder(CoreProperties.CORE_SKIPPED_MODULES_PROPERTY)
         .name("Exclude Modules")
@@ -540,6 +546,16 @@ public final class CorePlugin extends SonarPlugin {
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .onlyOnQualifiers(Qualifiers.PROJECT)
+        .index(0)
+        .build(),
+      PropertyDefinition.builder(CoreProperties.CORE_INCLUDED_MODULES_PROPERTY)
+        .name("Include Modules")
+        .description("Maven artifact ids of modules to include.")
+        .multiValues(true)
+        .category(CoreProperties.CATEGORY_EXCLUSIONS)
+        .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
+        .onlyOnQualifiers(Qualifiers.PROJECT)
+        .index(1)
         .build());
   }
 }
index bc5fafc667b462bd2ca7ae8e2f6b4feb3ff256ca..cd843c9ff80cb713789029bc2a0bf6f878dc819e 100644 (file)
@@ -817,6 +817,9 @@ category.exclusions.files.help=<h2>Wildcards</h2>\
 
 property.sonar.skippedModules.name=Exclude project modules from code analysis
 property.sonar.skippedModules.description=Comma separated list of module keys to be excluded from analysis. This property can be used for instance to exclude some Maven modules from a SonarQube analysis. Changes will be applied during next code analysis.
+property.sonar.includedModules.name=Include project modules in code analysis
+property.sonar.includedModules.description=Comma-separated list of the modules to analyse, all other modules are automatically ignored. Be careful: the root project must be added to the list.<br>\
+ If a module's artifactId differs from its module name (the directory name): it is the artifactId that should be use instead of the module name.
 property.category.exclusions.issues=Issues
 property.category.exclusions.issues.description=Configure which issues should not be reported.
 property.error.notBoolean=Valid options are "true" and "false"
index c61fb7137d781b8cb7e27283c454e80aba52e42c..10179b33102e40847d2790b2382ed370abe1cb3c 100644 (file)
@@ -69,7 +69,7 @@ public class ProjectExclusions implements TaskComponent {
   }
 
   private boolean isExcluded(String projectKey, boolean isRoot) {
-    String[] includedKeys = settings.getStringArray("sonar.includedModules");
+    String[] includedKeys = settings.getStringArray(CoreProperties.CORE_INCLUDED_MODULES_PROPERTY);
     boolean excluded = false;
     if (!isRoot && includedKeys.length > 0) {
       excluded = !ArrayUtils.contains(includedKeys, projectKey);
index 514ecb2a3721271a3b63f069844bf21f1cf925e4..b741be03da089d9e30dc2c3a8254668e89227d96 100644 (file)
@@ -145,6 +145,11 @@ public interface CoreProperties {
   String CORE_RULE_WEIGHTS_PROPERTY = "sonar.core.rule.weight";
   String CORE_RULE_WEIGHTS_DEFAULT_VALUE = "INFO=0;MINOR=1;MAJOR=3;CRITICAL=5;BLOCKER=10";
 
+  /**
+   * @since 4.0
+   */
+  String CORE_INCLUDED_MODULES_PROPERTY = "sonar.includedModules";
+
   /**
    * @deprecated since 3.6. See http://jira.codehaus.org/browse/SONAR-4145
    */