Skip to content

Commit

Permalink
Move CPD properties to make them back into UI
Browse files Browse the repository at this point in the history
  • Loading branch information
henryju committed Feb 18, 2015
1 parent 0ace1ca commit 3783b01
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 38 deletions.
36 changes: 0 additions & 36 deletions sonar-batch/src/main/java/org/sonar/batch/cpd/CpdComponents.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
package org.sonar.batch.cpd;

import com.google.common.collect.ImmutableList;
import org.sonar.api.CoreProperties;
import org.sonar.api.PropertyType;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.resources.Qualifiers;
import org.sonar.batch.cpd.decorators.DuplicationDensityDecorator;
import org.sonar.batch.cpd.decorators.SumDuplicationsDecorator;
import org.sonar.batch.cpd.index.IndexFactory;
Expand All @@ -34,38 +30,6 @@ public final class CpdComponents {

public static List all() {
return ImmutableList.of(
PropertyDefinition.builder(CoreProperties.CPD_CROSS_PROJECT)
.defaultValue(CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "")
.name("Cross project duplication detection")
.description("By default, SonarQube detects duplications at sub-project level. This means that a block "
+ "duplicated on two sub-projects of the same project won't be reported. Setting this parameter to \"true\" "
+ "allows to detect duplicates across sub-projects and more generally across projects. Note that activating "
+ "this property will slightly increase each SonarQube analysis time.")
.onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
.category(CoreProperties.CATEGORY_GENERAL)
.subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS)
.type(PropertyType.BOOLEAN)
.build(),
PropertyDefinition.builder(CoreProperties.CPD_SKIP_PROPERTY)
.defaultValue("false")
.name("Skip")
.description("Disable detection of duplications")
.hidden()
.category(CoreProperties.CATEGORY_GENERAL)
.subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS)
.type(PropertyType.BOOLEAN)
.build(),
PropertyDefinition.builder(CoreProperties.CPD_EXCLUSIONS)
.defaultValue("")
.name("Duplication Exclusions")
.description("Patterns used to exclude some source files from the duplication detection mechanism. " +
"See below to know how to use wildcards to specify this property.")
.onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
.category(CoreProperties.CATEGORY_EXCLUSIONS)
.subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS_EXCLUSIONS)
.multiValues(true)
.build(),

CpdSensor.class,
CpdMappings.class,
SumDuplicationsDecorator.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public class CpdComponentsTest {

@Test
public void getExtensions() {
assertThat(CpdComponents.all()).hasSize(10);
assertThat(CpdComponents.all().size()).isGreaterThan(0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.sonar.api.CoreProperties;
import org.sonar.api.PropertyType;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.resources.Qualifiers;
import org.sonar.core.computation.dbcleaner.DataCleanerProperties;
Expand Down Expand Up @@ -102,8 +103,41 @@ public static List<PropertyDefinition> all() {
.onlyOnQualifiers(Qualifiers.PROJECT)
.category(CoreProperties.CATEGORY_GENERAL)
.subCategory(CoreProperties.SUBCATEGORY_DIFFERENTIAL_VIEWS)
.build(),

// CPD
PropertyDefinition.builder(CoreProperties.CPD_CROSS_PROJECT)
.defaultValue(CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "")
.name("Cross project duplication detection")
.description("By default, SonarQube detects duplications at sub-project level. This means that a block "
+ "duplicated on two sub-projects of the same project won't be reported. Setting this parameter to \"true\" "
+ "allows to detect duplicates across sub-projects and more generally across projects. Note that activating "
+ "this property will slightly increase each SonarQube analysis time.")
.onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
.category(CoreProperties.CATEGORY_GENERAL)
.subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS)
.type(PropertyType.BOOLEAN)
.build(),
PropertyDefinition.builder(CoreProperties.CPD_SKIP_PROPERTY)
.defaultValue("false")
.name("Skip")
.description("Disable detection of duplications")
.hidden()
.category(CoreProperties.CATEGORY_GENERAL)
.subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS)
.type(PropertyType.BOOLEAN)
.build(),
PropertyDefinition.builder(CoreProperties.CPD_EXCLUSIONS)
.defaultValue("")
.name("Duplication Exclusions")
.description("Patterns used to exclude some source files from the duplication detection mechanism. " +
"See below to know how to use wildcards to specify this property.")
.onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
.category(CoreProperties.CATEGORY_EXCLUSIONS)
.subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS_EXCLUSIONS)
.multiValues(true)
.build()
));
));
return defs;
}
}

0 comments on commit 3783b01

Please sign in to comment.