summaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-01-16 16:20:45 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-01-16 16:21:13 +0100
commit8e03f8be326f8074f49c8c74bd58347740eafb73 (patch)
tree68cdf8b3e92110dabb4070742b1273257c437312 /sonar-plugin-api
parent49321e0d2b04a32359c14efb052f2f1aa51abc95 (diff)
downloadsonarqube-8e03f8be326f8074f49c8c74bd58347740eafb73.tar.gz
sonarqube-8e03f8be326f8074f49c8c74bd58347740eafb73.zip
SONAR-926 Merge Java package and directory concepts. Display full path of resources as name.
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/SquidUtils.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java1885
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java27
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java38
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java9
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java5
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/SquidUtilsTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/DirectoryTest.java4
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java82
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java22
13 files changed, 1047 insertions, 1056 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SquidUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SquidUtils.java
index c26100b9825..b514fb0a89b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SquidUtils.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SquidUtils.java
@@ -21,6 +21,7 @@ package org.sonar.api.batch;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
+import org.sonar.api.resources.Directory;
import org.sonar.api.resources.JavaFile;
import org.sonar.api.resources.JavaPackage;
@@ -48,9 +49,13 @@ public final class SquidUtils {
return new JavaFile(convertedKey);
}
+ /**
+ * @deprecated since 4.2 JavaPackage key is now the same than directory (ie path)
+ */
+ @Deprecated
public static JavaPackage convertJavaPackageKeyFromSquidFormat(String key) {
String convertedKey = key.replace('/', '.');
- return new JavaPackage(convertedKey);
+ return new Directory(key);
}
public static String convertToSquidKeyFormat(JavaFile file) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
index 4d199db052c..6e098e437ca 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
@@ -62,113 +62,122 @@ public final class CoreMetrics {
public static final String LINES_KEY = "lines";
public static final Metric LINES = new Metric.Builder(LINES_KEY, "Lines", Metric.ValueType.INT)
- .setDescription("Lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String GENERATED_LINES_KEY = "generated_lines";
public static final Metric GENERATED_LINES = new Metric.Builder(GENERATED_LINES_KEY, "Generated Lines", Metric.ValueType.INT)
- .setDescription("Number of generated lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Number of generated lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String NCLOC_KEY = "ncloc";
public static final Metric NCLOC = new Metric.Builder(NCLOC_KEY, "Lines of code", Metric.ValueType.INT)
- .setDescription("Non Commenting Lines of Code")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Non Commenting Lines of Code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String GENERATED_NCLOC_KEY = "generated_ncloc";
public static final Metric GENERATED_NCLOC = new Metric.Builder(GENERATED_NCLOC_KEY, "Generated lines of code", Metric.ValueType.INT)
- .setDescription("Generated non Commenting Lines of Code")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Generated non Commenting Lines of Code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String CLASSES_KEY = "classes";
public static final Metric CLASSES = new Metric.Builder(CLASSES_KEY, "Classes", Metric.ValueType.INT)
- .setDescription("Classes")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Classes")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String FILES_KEY = "files";
public static final Metric FILES = new Metric.Builder(FILES_KEY, "Files", Metric.ValueType.INT)
- .setDescription("Number of files")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .create();
+ .setDescription("Number of files")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .create();
public static final String DIRECTORIES_KEY = "directories";
public static final Metric DIRECTORIES = new Metric.Builder(DIRECTORIES_KEY, "Directories", Metric.ValueType.INT)
- .setDescription("Directories")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .create();
+ .setDescription("Directories")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .create();
+ /**
+ * @deprecated since 4.2 there is now only directory
+ */
+ @Deprecated
public static final String PACKAGES_KEY = "packages";
+ /**
+ * @deprecated since 4.2 there is now only directory
+ */
+ @Deprecated
public static final Metric PACKAGES = new Metric.Builder(PACKAGES_KEY, "Packages", Metric.ValueType.INT)
- .setDescription("Packages")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Packages")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .create();
public static final String FUNCTIONS_KEY = "functions";
public static final Metric FUNCTIONS = new Metric.Builder(FUNCTIONS_KEY, "Functions", Metric.ValueType.INT)
- .setDescription("Functions")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Functions")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String ACCESSORS_KEY = "accessors";
public static final Metric ACCESSORS = new Metric.Builder(ACCESSORS_KEY, "Accessors", Metric.ValueType.INT)
- .setDescription("Accessors")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Accessors")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String STATEMENTS_KEY = "statements";
public static final Metric STATEMENTS = new Metric.Builder(STATEMENTS_KEY, "Statements", Metric.ValueType.INT)
- .setDescription("Number of statements")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Number of statements")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String PUBLIC_API_KEY = "public_api";
public static final Metric PUBLIC_API = new Metric.Builder(PUBLIC_API_KEY, "Public API", Metric.ValueType.INT)
- .setDescription("Public API")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Public API")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
/**
* @since 3.0
@@ -179,11 +188,11 @@ public final class CoreMetrics {
* @since 3.0
*/
public static final Metric PROJECTS = new Metric.Builder(PROJECTS_KEY, "Projects", Metric.ValueType.INT)
- .setDescription("Number of projects")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_SIZE)
- .create();
+ .setDescription("Number of projects")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -193,20 +202,20 @@ public final class CoreMetrics {
public static final String COMMENT_LINES_KEY = "comment_lines";
public static final Metric COMMENT_LINES = new Metric.Builder(COMMENT_LINES_KEY, "Comment lines", Metric.ValueType.INT)
- .setDescription("Number of comment lines")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Number of comment lines")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String COMMENT_LINES_DENSITY_KEY = "comment_lines_density";
public static final Metric COMMENT_LINES_DENSITY = new Metric.Builder(COMMENT_LINES_DENSITY_KEY, "Comments (%)", Metric.ValueType.PERCENT)
- .setDescription("Comments balanced by ncloc + comment lines")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_DOCUMENTATION)
- .create();
+ .setDescription("Comments balanced by ncloc + comment lines")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .create();
/**
* @deprecated since 3.3 - see SONAR-3768
@@ -219,48 +228,48 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric COMMENT_BLANK_LINES = new Metric.Builder(COMMENT_BLANK_LINES_KEY, "Blank comments", Metric.ValueType.INT)
- .setDescription("Comments that do not contain comments")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Comments that do not contain comments")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String PUBLIC_DOCUMENTED_API_DENSITY_KEY = "public_documented_api_density";
public static final Metric PUBLIC_DOCUMENTED_API_DENSITY = new Metric.Builder(PUBLIC_DOCUMENTED_API_DENSITY_KEY, "Public documented API (%)", Metric.ValueType.PERCENT)
- .setDescription("Public documented classes and functions balanced by ncloc")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Public documented classes and functions balanced by ncloc")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String PUBLIC_UNDOCUMENTED_API_KEY = "public_undocumented_api";
public static final Metric PUBLIC_UNDOCUMENTED_API = new Metric.Builder(PUBLIC_UNDOCUMENTED_API_KEY, "Public undocumented API", Metric.ValueType.INT)
- .setDescription("Public undocumented classes, functions and variables")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setBestValue(0.0)
- .setDirection(Metric.DIRECTION_WORST)
- .setOptimizedBestValue(true)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Public undocumented classes, functions and variables")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setBestValue(0.0)
+ .setDirection(Metric.DIRECTION_WORST)
+ .setOptimizedBestValue(true)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String COMMENTED_OUT_CODE_LINES_KEY = "commented_out_code_lines";
public static final Metric COMMENTED_OUT_CODE_LINES = new Metric.Builder(COMMENTED_OUT_CODE_LINES_KEY, "Commented-out LOC", Metric.ValueType.INT)
- .setDescription("Commented lines of code")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DOCUMENTATION)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Commented lines of code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -270,21 +279,21 @@ public final class CoreMetrics {
public static final String COMPLEXITY_KEY = "complexity";
public static final Metric COMPLEXITY = new Metric.Builder(COMPLEXITY_KEY, "Complexity", Metric.ValueType.INT)
- .setDescription("Cyclomatic complexity")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Cyclomatic complexity")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String FILE_COMPLEXITY_KEY = "file_complexity";
public static final Metric FILE_COMPLEXITY = new Metric.Builder(FILE_COMPLEXITY_KEY, "Complexity /file", Metric.ValueType.FLOAT)
- .setDescription("Complexity average by file")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(AverageFormula.create(CoreMetrics.COMPLEXITY, CoreMetrics.FILES))
- .create();
+ .setDescription("Complexity average by file")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(AverageFormula.create(CoreMetrics.COMPLEXITY, CoreMetrics.FILES))
+ .create();
/**
* @since 3.6
@@ -295,13 +304,13 @@ public final class CoreMetrics {
* @since 3.6
*/
public static final Metric COMPLEXITY_IN_CLASSES = new Metric.Builder(COMPLEXITY_IN_CLASSES_KEY, "Complexity in classes", Metric.ValueType.INT)
- .setDescription("Cyclomatic complexity in classes")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildValuesFormula(false))
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Cyclomatic complexity in classes")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildValuesFormula(false))
+ .setDeleteHistoricalData(true)
+ .create();
public static final String CLASS_COMPLEXITY_KEY = "class_complexity";
@@ -310,12 +319,12 @@ public final class CoreMetrics {
* If the complexity in classes is not available, the complexity of the file is used.
*/
public static final Metric CLASS_COMPLEXITY = new Metric.Builder(CLASS_COMPLEXITY_KEY, "Complexity /class", Metric.ValueType.FLOAT)
- .setDescription("Complexity average by class")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(AverageFormula.create(CoreMetrics.COMPLEXITY_IN_CLASSES, CoreMetrics.CLASSES).setFallbackForMainMetric(CoreMetrics.COMPLEXITY))
- .create();
+ .setDescription("Complexity average by class")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(AverageFormula.create(CoreMetrics.COMPLEXITY_IN_CLASSES, CoreMetrics.CLASSES).setFallbackForMainMetric(CoreMetrics.COMPLEXITY))
+ .create();
/**
* @since 3.6
@@ -326,13 +335,13 @@ public final class CoreMetrics {
* @since 3.6
*/
public static final Metric COMPLEXITY_IN_FUNCTIONS = new Metric.Builder(COMPLEXITY_IN_FUNCTIONS_KEY, "Complexity in functions", Metric.ValueType.INT)
- .setDescription("Cyclomatic complexity in functions")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildValuesFormula(false))
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Cyclomatic complexity in functions")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildValuesFormula(false))
+ .setDeleteHistoricalData(true)
+ .create();
public static final String FUNCTION_COMPLEXITY_KEY = "function_complexity";
@@ -341,12 +350,12 @@ public final class CoreMetrics {
* If the complexity in functions is not available, the complexity of the file is used.
*/
public static final Metric FUNCTION_COMPLEXITY = new Metric.Builder(FUNCTION_COMPLEXITY_KEY, "Complexity /function", Metric.ValueType.FLOAT)
- .setDescription("Complexity average by function")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(AverageFormula.create(CoreMetrics.COMPLEXITY_IN_FUNCTIONS, CoreMetrics.FUNCTIONS).setFallbackForMainMetric(CoreMetrics.COMPLEXITY))
- .create();
+ .setDescription("Complexity average by function")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(AverageFormula.create(CoreMetrics.COMPLEXITY_IN_FUNCTIONS, CoreMetrics.FUNCTIONS).setFallbackForMainMetric(CoreMetrics.COMPLEXITY))
+ .create();
/**
* @deprecated in 3.0 - see SONAR-3289
@@ -359,31 +368,31 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric CLASS_COMPLEXITY_DISTRIBUTION = new Metric.Builder(CLASS_COMPLEXITY_DISTRIBUTION_KEY, "Classes distribution /complexity", Metric.ValueType.DISTRIB)
- .setDescription("Classes distribution /complexity")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Classes distribution /complexity")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
public static final String FUNCTION_COMPLEXITY_DISTRIBUTION_KEY = "function_complexity_distribution";
public static final Metric FUNCTION_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FUNCTION_COMPLEXITY_DISTRIBUTION_KEY, "Functions distribution /complexity",
- Metric.ValueType.DISTRIB)
- .setDescription("Functions distribution /complexity")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ Metric.ValueType.DISTRIB)
+ .setDescription("Functions distribution /complexity")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
public static final String FILE_COMPLEXITY_DISTRIBUTION_KEY = "file_complexity_distribution";
public static final Metric FILE_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FILE_COMPLEXITY_DISTRIBUTION_KEY, "Files distribution /complexity", Metric.ValueType.DISTRIB)
- .setDescription("Files distribution /complexity")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Files distribution /complexity")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_COMPLEXITY)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -403,88 +412,88 @@ public final class CoreMetrics {
* </ul>
*/
public static final Metric TESTS = new Metric.Builder(TESTS_KEY, "Unit tests", Metric.ValueType.INT)
- .setDescription("Number of unit tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDescription("Number of unit tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String TEST_EXECUTION_TIME_KEY = "test_execution_time";
public static final Metric TEST_EXECUTION_TIME = new Metric.Builder(TEST_EXECUTION_TIME_KEY, "Unit tests duration", Metric.ValueType.MILLISEC)
- .setDescription("Execution duration of unit tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDescription("Execution duration of unit tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String TEST_ERRORS_KEY = "test_errors";
public static final Metric TEST_ERRORS = new Metric.Builder(TEST_ERRORS_KEY, "Unit test errors", Metric.ValueType.INT)
- .setDescription("Number of unit test errors")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Number of unit test errors")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String SKIPPED_TESTS_KEY = "skipped_tests";
public static final Metric SKIPPED_TESTS = new Metric.Builder(SKIPPED_TESTS_KEY, "Skipped unit tests", Metric.ValueType.INT)
- .setDescription("Number of skipped unit tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Number of skipped unit tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String TEST_FAILURES_KEY = "test_failures";
public static final Metric TEST_FAILURES = new Metric.Builder(TEST_FAILURES_KEY, "Unit test failures", Metric.ValueType.INT)
- .setDescription("Number of unit test failures")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Number of unit test failures")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String TEST_SUCCESS_DENSITY_KEY = "test_success_density";
public static final Metric TEST_SUCCESS_DENSITY = new Metric.Builder(TEST_SUCCESS_DENSITY_KEY, "Unit test success (%)", Metric.ValueType.PERCENT)
- .setDescription("Density of successful unit tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Density of successful unit tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String TEST_DATA_KEY = "test_data";
public static final Metric TEST_DATA = new Metric.Builder(TEST_DATA_KEY, "Unit tests details", Metric.ValueType.DATA)
- .setDescription("Unit tests details")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .create();
+ .setDescription("Unit tests details")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .create();
public static final String COVERAGE_KEY = "coverage";
public static final Metric COVERAGE = new Metric.Builder(COVERAGE_KEY, "Coverage", Metric.ValueType.PERCENT)
- .setDescription("Coverage by unit tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Coverage by unit tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
public static final String NEW_COVERAGE_KEY = "new_coverage";
public static final Metric NEW_COVERAGE = new Metric.Builder(NEW_COVERAGE_KEY, "Coverage on new code", Metric.ValueType.PERCENT)
- .setDescription("Coverage of new/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Coverage of new/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String LINES_TO_COVER_KEY = "lines_to_cover";
@@ -492,22 +501,22 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric LINES_TO_COVER = new Metric.Builder(LINES_TO_COVER_KEY, "Lines to cover", Metric.ValueType.INT)
- .setDescription("Lines to cover")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Lines to cover")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String NEW_LINES_TO_COVER_KEY = "new_lines_to_cover";
public static final Metric NEW_LINES_TO_COVER = new Metric.Builder(NEW_LINES_TO_COVER_KEY, "Lines to cover on new code", Metric.ValueType.INT)
- .setDescription("Lines to cover on new code")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Lines to cover on new code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setDeleteHistoricalData(true)
+ .create();
public static final String UNCOVERED_LINES_KEY = "uncovered_lines";
@@ -515,43 +524,43 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric UNCOVERED_LINES = new Metric.Builder(UNCOVERED_LINES_KEY, "Uncovered lines", Metric.ValueType.INT)
- .setDescription("Uncovered lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .create();
+ .setDescription("Uncovered lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .create();
public static final String NEW_UNCOVERED_LINES_KEY = "new_uncovered_lines";
public static final Metric NEW_UNCOVERED_LINES = new Metric.Builder(NEW_UNCOVERED_LINES_KEY, "Uncovered lines on new code", Metric.ValueType.INT)
- .setDescription("Uncovered lines on new code")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Uncovered lines on new code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String LINE_COVERAGE_KEY = "line_coverage";
public static final Metric LINE_COVERAGE = new Metric.Builder(LINE_COVERAGE_KEY, "Line coverage", Metric.ValueType.PERCENT)
- .setDescription("Line coverage")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Line coverage")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
public static final String NEW_LINE_COVERAGE_KEY = "new_line_coverage";
public static final Metric NEW_LINE_COVERAGE = new Metric.Builder(NEW_LINE_COVERAGE_KEY, "Line coverage on new code", Metric.ValueType.PERCENT)
- .setDescription("Line coverage of added/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDomain(DOMAIN_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Line coverage of added/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDomain(DOMAIN_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String COVERAGE_LINE_HITS_DATA_KEY = "coverage_line_hits_data";
@@ -560,9 +569,9 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric COVERAGE_LINE_HITS_DATA = new Metric.Builder(COVERAGE_LINE_HITS_DATA_KEY, "Coverage hits by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDomain(DOMAIN_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String CONDITIONS_TO_COVER_KEY = "conditions_to_cover";
@@ -570,20 +579,20 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric CONDITIONS_TO_COVER = new Metric.Builder(CONDITIONS_TO_COVER_KEY, "Branches to cover", Metric.ValueType.INT)
- .setDescription("Branches to cover")
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .create();
+ .setDescription("Branches to cover")
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .create();
public static final String NEW_CONDITIONS_TO_COVER_KEY = "new_conditions_to_cover";
public static final Metric NEW_CONDITIONS_TO_COVER = new Metric.Builder(NEW_CONDITIONS_TO_COVER_KEY, "Branches to cover on new code", Metric.ValueType.INT)
- .setDescription("Branches to cover on new code")
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setDeleteHistoricalData(true)
- .setHidden(true)
- .create();
+ .setDescription("Branches to cover on new code")
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setDeleteHistoricalData(true)
+ .setHidden(true)
+ .create();
public static final String UNCOVERED_CONDITIONS_KEY = "uncovered_conditions";
@@ -591,43 +600,43 @@ public final class CoreMetrics {
* Use {@link CoverageMeasuresBuilder} to build measure for this metric.
*/
public static final Metric UNCOVERED_CONDITIONS = new Metric.Builder(UNCOVERED_CONDITIONS_KEY, "Uncovered branches", Metric.ValueType.INT)
- .setDescription("Uncovered branches")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .create();
+ .setDescription("Uncovered branches")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .create();
public static final String NEW_UNCOVERED_CONDITIONS_KEY = "new_uncovered_conditions";
public static final Metric NEW_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_UNCOVERED_CONDITIONS_KEY, "Uncovered branches on new code", Metric.ValueType.INT)
- .setDescription("Uncovered branches on new code")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Uncovered branches on new code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String BRANCH_COVERAGE_KEY = "branch_coverage";
public static final Metric BRANCH_COVERAGE = new Metric.Builder(BRANCH_COVERAGE_KEY, "Branch coverage", Metric.ValueType.PERCENT)
- .setDescription("Branch coverage")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Branch coverage")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
public static final String NEW_BRANCH_COVERAGE_KEY = "new_branch_coverage";
public static final Metric NEW_BRANCH_COVERAGE = new Metric.Builder(NEW_BRANCH_COVERAGE_KEY, "Branch coverage on new code", Metric.ValueType.PERCENT)
- .setDescription("Branch coverage of new/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Branch coverage of new/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @deprecated in 2.7. Replaced by {@link #CONDITIONS_BY_LINE_KEY} and {@link #COVERED_CONDITIONS_BY_LINE_KEY}
@@ -640,9 +649,9 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric BRANCH_COVERAGE_HITS_DATA = new Metric.Builder(BRANCH_COVERAGE_HITS_DATA_KEY, "Branch coverage hits", Metric.ValueType.DATA)
- .setDomain(DOMAIN_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDomain(DOMAIN_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String CONDITIONS_BY_LINE_KEY = "conditions_by_line";
@@ -652,9 +661,9 @@ public final class CoreMetrics {
* @since 2.7
*/
public static final Metric CONDITIONS_BY_LINE = new Metric.Builder(CONDITIONS_BY_LINE_KEY, "Conditions by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDomain(DOMAIN_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String COVERED_CONDITIONS_BY_LINE_KEY = "covered_conditions_by_line";
@@ -664,9 +673,9 @@ public final class CoreMetrics {
* @since 2.7
*/
public static final Metric COVERED_CONDITIONS_BY_LINE = new Metric.Builder(COVERED_CONDITIONS_BY_LINE_KEY, "Covered conditions by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDomain(DOMAIN_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -683,13 +692,13 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_COVERAGE = new Metric.Builder(IT_COVERAGE_KEY, "IT coverage", Metric.ValueType.PERCENT)
- .setDescription("Coverage by integration tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Coverage by integration tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
/**
* @since 2.12
@@ -700,14 +709,14 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric NEW_IT_COVERAGE = new Metric.Builder(NEW_IT_COVERAGE_KEY, "Coverage by IT on new code", Metric.ValueType.PERCENT)
- .setDescription("Integration Tests Coverage of new/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Integration Tests Coverage of new/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 2.12
@@ -718,14 +727,14 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_LINES_TO_COVER = new Metric.Builder(IT_LINES_TO_COVER_KEY, "IT lines to cover", Metric.ValueType.INT)
- .setDescription("Lines to cover by Integration Tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setQualitative(false)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Lines to cover by Integration Tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setQualitative(false)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 2.12
@@ -736,13 +745,13 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric NEW_IT_LINES_TO_COVER = new Metric.Builder(NEW_IT_LINES_TO_COVER_KEY, "Lines to cover by IT on new code", Metric.ValueType.INT)
- .setDescription("Lines to cover by Integration Tests on new code")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Lines to cover by Integration Tests on new code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 2.12
@@ -753,12 +762,12 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_UNCOVERED_LINES = new Metric.Builder(IT_UNCOVERED_LINES_KEY, "IT uncovered lines", Metric.ValueType.INT)
- .setDescription("IT uncovered lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("IT uncovered lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
/**
* @since 2.12
@@ -769,13 +778,13 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric NEW_IT_UNCOVERED_LINES = new Metric.Builder(NEW_IT_UNCOVERED_LINES_KEY, "Uncovered lines by IT on new code", Metric.ValueType.INT)
- .setDescription("Uncovered lines by IT on new code")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Uncovered lines by IT on new code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 2.12
@@ -786,11 +795,11 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_LINE_COVERAGE = new Metric.Builder(IT_LINE_COVERAGE_KEY, "IT line coverage", Metric.ValueType.PERCENT)
- .setDescription("IT line coverage")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .create();
+ .setDescription("IT line coverage")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .create();
/**
* @since 2.12
@@ -801,14 +810,14 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric NEW_IT_LINE_COVERAGE = new Metric.Builder(NEW_IT_LINE_COVERAGE_KEY, "Line coverage by IT on new code", Metric.ValueType.PERCENT)
- .setDescription("Line Coverage by Integration Tests of added/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Line Coverage by Integration Tests of added/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 2.12
@@ -819,12 +828,12 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_COVERAGE_LINE_HITS_DATA = new Metric.Builder(IT_COVERAGE_LINE_HITS_DATA_KEY, "IT coverage hits data", Metric.ValueType.DATA)
- .setDescription("Integration Tests Code coverage line hits data")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Integration Tests Code coverage line hits data")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 2.12
@@ -835,13 +844,13 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_CONDITIONS_TO_COVER = new Metric.Builder(IT_CONDITIONS_TO_COVER_KEY, "IT branches to cover", Metric.ValueType.INT)
- .setDescription("Integration Tests conditions to cover")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .create();
+ .setDescription("Integration Tests conditions to cover")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .create();
/**
* @since 2.12
@@ -852,12 +861,12 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric NEW_IT_CONDITIONS_TO_COVER = new Metric.Builder(NEW_IT_CONDITIONS_TO_COVER_KEY, "Branches to cover by IT on new code", Metric.ValueType.INT)
- .setDescription("Branches to cover by Integration Tests on new code")
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setDeleteHistoricalData(true)
- .setHidden(true)
- .create();
+ .setDescription("Branches to cover by Integration Tests on new code")
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setDeleteHistoricalData(true)
+ .setHidden(true)
+ .create();
/**
* @since 2.12
@@ -868,11 +877,11 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_UNCOVERED_CONDITIONS = new Metric.Builder(IT_UNCOVERED_CONDITIONS_KEY, "IT uncovered branches", Metric.ValueType.INT)
- .setDescription("Integration Tests uncovered conditions")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Integration Tests uncovered conditions")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
/**
* @since 2.12
@@ -883,13 +892,13 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric NEW_IT_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_IT_UNCOVERED_CONDITIONS_KEY, "Uncovered branches by IT on new code", Metric.ValueType.INT)
- .setDescription("Uncovered branches by Integration Tests on new code")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Uncovered branches by Integration Tests on new code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 2.12
@@ -900,13 +909,13 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_BRANCH_COVERAGE = new Metric.Builder(IT_BRANCH_COVERAGE_KEY, "IT branch coverage", Metric.ValueType.PERCENT)
- .setDescription("IT Branch coverage")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("IT Branch coverage")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
/**
* @since 2.12
@@ -917,14 +926,14 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric NEW_IT_BRANCH_COVERAGE = new Metric.Builder(NEW_IT_BRANCH_COVERAGE_KEY, "Branch coverage by IT on new code", Metric.ValueType.PERCENT)
- .setDescription("Branch coverage by Integration Tests of new/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Branch coverage by Integration Tests of new/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 2.12
@@ -935,9 +944,9 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_CONDITIONS_BY_LINE = new Metric.Builder(IT_CONDITIONS_BY_LINE_KEY, "IT branches by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 2.12
@@ -948,9 +957,9 @@ public final class CoreMetrics {
* @since 2.12
*/
public static final Metric IT_COVERED_CONDITIONS_BY_LINE = new Metric.Builder(IT_COVERED_CONDITIONS_BY_LINE_KEY, "IT covered branches by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_INTEGRATION_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDomain(DOMAIN_INTEGRATION_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -967,13 +976,13 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_COVERAGE = new Metric.Builder(OVERALL_COVERAGE_KEY, "Overall coverage", Metric.ValueType.PERCENT)
- .setDescription("Overall test coverage")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Overall test coverage")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
/**
* @since 3.3
@@ -984,14 +993,14 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric NEW_OVERALL_COVERAGE = new Metric.Builder(NEW_OVERALL_COVERAGE_KEY, "Overall coverage on new code", Metric.ValueType.PERCENT)
- .setDescription("Overall coverage of new/changed code")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Overall coverage of new/changed code")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.3
@@ -1002,14 +1011,14 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_LINES_TO_COVER = new Metric.Builder(OVERALL_LINES_TO_COVER_KEY, "Overall lines to cover", Metric.ValueType.INT)
- .setDescription("Overall lines to cover by all tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setQualitative(false)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Overall lines to cover by all tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setQualitative(false)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.3
@@ -1020,13 +1029,13 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric NEW_OVERALL_LINES_TO_COVER = new Metric.Builder(NEW_OVERALL_LINES_TO_COVER_KEY, "Overall lines to cover on new code", Metric.ValueType.INT)
- .setDescription("New lines to cover by all tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("New lines to cover by all tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.3
@@ -1037,12 +1046,12 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_UNCOVERED_LINES = new Metric.Builder(OVERALL_UNCOVERED_LINES_KEY, "Overall uncovered lines", Metric.ValueType.INT)
- .setDescription("Uncovered lines by all tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Uncovered lines by all tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
/**
* @since 3.3
@@ -1053,13 +1062,13 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric NEW_OVERALL_UNCOVERED_LINES = new Metric.Builder(NEW_OVERALL_UNCOVERED_LINES_KEY, "Overall uncovered lines on new code", Metric.ValueType.INT)
- .setDescription("New lines that are not covered by any tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("New lines that are not covered by any tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.3
@@ -1070,11 +1079,11 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_LINE_COVERAGE = new Metric.Builder(OVERALL_LINE_COVERAGE_KEY, "Overall line coverage", Metric.ValueType.PERCENT)
- .setDescription("Line coverage by all tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .create();
+ .setDescription("Line coverage by all tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .create();
/**
* @since 3.3
@@ -1085,14 +1094,14 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric NEW_OVERALL_LINE_COVERAGE = new Metric.Builder(NEW_OVERALL_LINE_COVERAGE_KEY, "Overall line coverage on new code", Metric.ValueType.PERCENT)
- .setDescription("Line coverage of added/changed code by all tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Line coverage of added/changed code by all tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.3
@@ -1103,12 +1112,12 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_COVERAGE_LINE_HITS_DATA = new Metric.Builder(OVERALL_COVERAGE_LINE_HITS_DATA_KEY, "Overall coverage hits by line", Metric.ValueType.DATA)
- .setDescription("Coverage hits by all tests and by line")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Coverage hits by all tests and by line")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.3
@@ -1119,13 +1128,13 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_CONDITIONS_TO_COVER = new Metric.Builder(OVERALL_CONDITIONS_TO_COVER_KEY, "Overall branches to cover", Metric.ValueType.INT)
- .setDescription("Branches to cover by all tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .create();
+ .setDescription("Branches to cover by all tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .create();
/**
* @since 3.3
@@ -1136,13 +1145,13 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric NEW_OVERALL_CONDITIONS_TO_COVER = new Metric.Builder(NEW_OVERALL_CONDITIONS_TO_COVER_KEY, "Overall branches to cover on new code",
- Metric.ValueType.INT)
- .setDescription("New branches to cover by all tests")
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setDeleteHistoricalData(true)
- .setHidden(true)
- .create();
+ Metric.ValueType.INT)
+ .setDescription("New branches to cover by all tests")
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setDeleteHistoricalData(true)
+ .setHidden(true)
+ .create();
/**
* @since 3.3
@@ -1153,11 +1162,11 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_UNCOVERED_CONDITIONS = new Metric.Builder(OVERALL_UNCOVERED_CONDITIONS_KEY, "Overall uncovered branches", Metric.ValueType.INT)
- .setDescription("Uncovered branches by all tests")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Uncovered branches by all tests")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
/**
* @since 3.3
@@ -1168,14 +1177,14 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric NEW_OVERALL_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_OVERALL_UNCOVERED_CONDITIONS_KEY, "Overall uncovered branches on new code",
- Metric.ValueType.INT)
- .setDescription("New branches that are not covered by any test")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .setDeleteHistoricalData(true)
- .create();
+ Metric.ValueType.INT)
+ .setDescription("New branches that are not covered by any test")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.3
@@ -1186,13 +1195,13 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_BRANCH_COVERAGE = new Metric.Builder(OVERALL_BRANCH_COVERAGE_KEY, "Overall branch coverage", Metric.ValueType.PERCENT)
- .setDescription("Branch coverage by all tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .create();
+ .setDescription("Branch coverage by all tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .create();
/**
* @since 3.3
@@ -1203,14 +1212,14 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric NEW_OVERALL_BRANCH_COVERAGE = new Metric.Builder(NEW_OVERALL_BRANCH_COVERAGE_KEY, "Overall branch coverage on new code", Metric.ValueType.PERCENT)
- .setDescription("Branch coverage of new/changed code by all tests")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setWorstValue(0.0)
- .setBestValue(100.0)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Branch coverage of new/changed code by all tests")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setWorstValue(0.0)
+ .setBestValue(100.0)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.3
@@ -1221,10 +1230,10 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_CONDITIONS_BY_LINE = new Metric.Builder(OVERALL_CONDITIONS_BY_LINE_KEY, "Overall branches by line", Metric.ValueType.DATA)
- .setDescription("Overall branches by all tests and by line")
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Overall branches by all tests and by line")
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.3
@@ -1235,11 +1244,11 @@ public final class CoreMetrics {
* @since 3.3
*/
public static final Metric OVERALL_COVERED_CONDITIONS_BY_LINE = new Metric.Builder(OVERALL_COVERED_CONDITIONS_BY_LINE_KEY, "Overall covered branches by line",
- Metric.ValueType.DATA)
- .setDescription("Overall covered branches by all tests and by line")
- .setDomain(DOMAIN_OVERALL_TESTS)
- .setDeleteHistoricalData(true)
- .create();
+ Metric.ValueType.DATA)
+ .setDescription("Overall covered branches by all tests and by line")
+ .setDomain(DOMAIN_OVERALL_TESTS)
+ .setDeleteHistoricalData(true)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -1249,23 +1258,23 @@ public final class CoreMetrics {
public static final String DUPLICATED_LINES_KEY = "duplicated_lines";
public static final Metric DUPLICATED_LINES = new Metric.Builder(DUPLICATED_LINES_KEY, "Duplicated lines", Metric.ValueType.INT)
- .setDescription("Duplicated lines")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DUPLICATION)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Duplicated lines")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DUPLICATION)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String DUPLICATED_BLOCKS_KEY = "duplicated_blocks";
public static final Metric DUPLICATED_BLOCKS = new Metric.Builder(DUPLICATED_BLOCKS_KEY, "Duplicated blocks", Metric.ValueType.INT)
- .setDescription("Duplicated blocks")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DUPLICATION)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Duplicated blocks")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DUPLICATION)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String DUPLICATED_FILES_KEY = "duplicated_files";
@@ -1274,24 +1283,24 @@ public final class CoreMetrics {
* For other resources: amount of files under this resource with duplicates.
*/
public static final Metric DUPLICATED_FILES = new Metric.Builder(DUPLICATED_FILES_KEY, "Duplicated files", Metric.ValueType.INT)
- .setDescription("Duplicated files")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DUPLICATION)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Duplicated files")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DUPLICATION)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String DUPLICATED_LINES_DENSITY_KEY = "duplicated_lines_density";
public static final Metric DUPLICATED_LINES_DENSITY = new Metric.Builder(DUPLICATED_LINES_DENSITY_KEY, "Duplicated lines (%)", Metric.ValueType.PERCENT)
- .setDescription("Duplicated lines balanced by statements")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DUPLICATION)
- .setWorstValue(50.0)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Duplicated lines balanced by statements")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DUPLICATION)
+ .setWorstValue(50.0)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String DUPLICATIONS_DATA_KEY = "duplications_data";
@@ -1313,12 +1322,12 @@ public final class CoreMetrics {
* </p>
*/
public static final Metric DUPLICATIONS_DATA = new Metric.Builder(DUPLICATIONS_DATA_KEY, "Duplications details", Metric.ValueType.DATA)
- .setDescription("Duplications details")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DUPLICATION)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Duplications details")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DUPLICATION)
+ .setDeleteHistoricalData(true)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -1337,13 +1346,13 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric WEIGHTED_VIOLATIONS = new Metric.Builder(WEIGHTED_VIOLATIONS_KEY, "Weighted issues", Metric.ValueType.INT)
- .setDescription("Weighted Issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Weighted Issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
/**
* @deprecated since 4.0. See SONAR-4755
@@ -1356,137 +1365,137 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric VIOLATIONS_DENSITY = new Metric.Builder(VIOLATIONS_DENSITY_KEY, "Rules compliance", Metric.ValueType.PERCENT)
- .setDescription("Rules compliance")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .create();
+ .setDescription("Rules compliance")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .create();
public static final String VIOLATIONS_KEY = "violations";
public static final Metric VIOLATIONS = new Metric.Builder(VIOLATIONS_KEY, "Issues", Metric.ValueType.INT)
- .setDescription("Issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String BLOCKER_VIOLATIONS_KEY = "blocker_violations";
public static final Metric BLOCKER_VIOLATIONS = new Metric.Builder(BLOCKER_VIOLATIONS_KEY, "Blocker issues", Metric.ValueType.INT)
- .setDescription("Blocker issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Blocker issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String CRITICAL_VIOLATIONS_KEY = "critical_violations";
public static final Metric CRITICAL_VIOLATIONS = new Metric.Builder(CRITICAL_VIOLATIONS_KEY, "Critical issues", Metric.ValueType.INT)
- .setDescription("Critical issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Critical issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String MAJOR_VIOLATIONS_KEY = "major_violations";
public static final Metric MAJOR_VIOLATIONS = new Metric.Builder(MAJOR_VIOLATIONS_KEY, "Major issues", Metric.ValueType.INT)
- .setDescription("Major issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Major issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String MINOR_VIOLATIONS_KEY = "minor_violations";
public static final Metric MINOR_VIOLATIONS = new Metric.Builder(MINOR_VIOLATIONS_KEY, "Minor issues", Metric.ValueType.INT)
- .setDescription("Minor issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Minor issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String INFO_VIOLATIONS_KEY = "info_violations";
public static final Metric INFO_VIOLATIONS = new Metric.Builder(INFO_VIOLATIONS_KEY, "Info issues", Metric.ValueType.INT)
- .setDescription("Info issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Info issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
public static final String NEW_VIOLATIONS_KEY = "new_violations";
public static final Metric NEW_VIOLATIONS = new Metric.Builder(NEW_VIOLATIONS_KEY, "New issues", Metric.ValueType.INT)
- .setDescription("New Issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("New Issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String NEW_BLOCKER_VIOLATIONS_KEY = "new_blocker_violations";
public static final Metric NEW_BLOCKER_VIOLATIONS = new Metric.Builder(NEW_BLOCKER_VIOLATIONS_KEY, "New Blocker issues", Metric.ValueType.INT)
- .setDescription("New Blocker issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("New Blocker issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String NEW_CRITICAL_VIOLATIONS_KEY = "new_critical_violations";
public static final Metric NEW_CRITICAL_VIOLATIONS = new Metric.Builder(NEW_CRITICAL_VIOLATIONS_KEY, "New Critical issues", Metric.ValueType.INT)
- .setDescription("New Critical issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("New Critical issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String NEW_MAJOR_VIOLATIONS_KEY = "new_major_violations";
public static final Metric NEW_MAJOR_VIOLATIONS = new Metric.Builder(NEW_MAJOR_VIOLATIONS_KEY, "New Major issues", Metric.ValueType.INT)
- .setDescription("New Major issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("New Major issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String NEW_MINOR_VIOLATIONS_KEY = "new_minor_violations";
public static final Metric NEW_MINOR_VIOLATIONS = new Metric.Builder(NEW_MINOR_VIOLATIONS_KEY, "New Minor issues", Metric.ValueType.INT)
- .setDescription("New Minor issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("New Minor issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String NEW_INFO_VIOLATIONS_KEY = "new_info_violations";
public static final Metric NEW_INFO_VIOLATIONS = new Metric.Builder(NEW_INFO_VIOLATIONS_KEY, "New Info issues", Metric.ValueType.INT)
- .setDescription("New Info issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("New Info issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @since 3.6
@@ -1497,12 +1506,12 @@ public final class CoreMetrics {
* @since 3.6
*/
public static final Metric FALSE_POSITIVE_ISSUES = new Metric.Builder(FALSE_POSITIVE_ISSUES_KEY, "False positive issues", Metric.ValueType.INT)
- .setDescription("False positive issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("False positive issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
/**
* @since 3.6
@@ -1513,12 +1522,12 @@ public final class CoreMetrics {
* @since 3.6
*/
public static final Metric OPEN_ISSUES = new Metric.Builder(OPEN_ISSUES_KEY, "Open issues", Metric.ValueType.INT)
- .setDescription("Open issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Open issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
/**
* @since 3.6
@@ -1529,13 +1538,13 @@ public final class CoreMetrics {
* @since 3.6
*/
public static final Metric REOPENED_ISSUES = new Metric.Builder(REOPENED_ISSUES_KEY, "Reopened issues", Metric.ValueType.INT)
- .setDescription("Reopened issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Reopened issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
/**
* @since 3.6
@@ -1546,13 +1555,13 @@ public final class CoreMetrics {
* @since 3.6
*/
public static final Metric CONFIRMED_ISSUES = new Metric.Builder(CONFIRMED_ISSUES_KEY, "Confirmed issues", Metric.ValueType.INT)
- .setDescription("Confirmed issues")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_ISSUES)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .create();
+ .setDescription("Confirmed issues")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_ISSUES)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -1570,12 +1579,12 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric ABSTRACTNESS = new Metric.Builder(ABSTRACTNESS_KEY, "Abstractness", Metric.ValueType.PERCENT)
- .setDescription("Abstractness")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("Abstractness")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
/**
* @deprecated since 3.7.1
@@ -1587,12 +1596,12 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric INSTABILITY = new Metric.Builder(INSTABILITY_KEY, "Instability", Metric.ValueType.PERCENT)
- .setDescription("Instability")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("Instability")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
/**
* @deprecated since 3.7.1
@@ -1604,12 +1613,12 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric DISTANCE = new Metric.Builder(DISTANCE_KEY, "Distance", Metric.ValueType.FLOAT)
- .setDescription("Distance")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("Distance")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
/**
* @deprecated since 4.0. See SONAR-4643
@@ -1621,12 +1630,12 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric DEPTH_IN_TREE = new Metric.Builder(DEPTH_IN_TREE_KEY, "Depth in Tree", Metric.ValueType.INT)
- .setDescription("Depth in Inheritance Tree")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("Depth in Inheritance Tree")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
/**
* @deprecated since 4.0. See SONAR-4643
@@ -1638,30 +1647,30 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric NUMBER_OF_CHILDREN = new Metric.Builder(NUMBER_OF_CHILDREN_KEY, "Number of Children", Metric.ValueType.INT)
- .setDescription("Number of Children")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .create();
+ .setDescription("Number of Children")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .create();
public static final String RFC_KEY = "rfc";
public static final Metric RFC = new Metric.Builder(RFC_KEY, "RFC", Metric.ValueType.INT)
- .setDescription("Response for Class")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new WeightedMeanAggregationFormula(CoreMetrics.FILES, false))
- .create();
+ .setDescription("Response for Class")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new WeightedMeanAggregationFormula(CoreMetrics.FILES, false))
+ .create();
public static final String RFC_DISTRIBUTION_KEY = "rfc_distribution";
public static final Metric RFC_DISTRIBUTION = new Metric.Builder(RFC_DISTRIBUTION_KEY, "Class distribution /RFC", Metric.ValueType.DISTRIB)
- .setDescription("Class distribution /RFC")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Class distribution /RFC")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
/**
* @deprecated in 4.1. See http://jira.codehaus.org/browse/SONAR-4853
@@ -1674,12 +1683,12 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric LCOM4 = new Metric.Builder(LCOM4_KEY, "LCOM4", Metric.ValueType.FLOAT)
- .setDescription("Lack of Cohesion of Functions")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setBestValue(1.0)
- .create();
+ .setDescription("Lack of Cohesion of Functions")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setBestValue(1.0)
+ .create();
/**
* @deprecated in 4.1. See http://jira.codehaus.org/browse/SONAR-4853
@@ -1692,13 +1701,13 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric LCOM4_BLOCKS = new Metric.Builder(LCOM4_BLOCKS_KEY, "LCOM4 blocks", Metric.ValueType.DATA)
- .setDescription("LCOM4 blocks")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("LCOM4 blocks")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .setDeleteHistoricalData(true)
+ .create();
/**
* @deprecated in 4.1. See http://jira.codehaus.org/browse/SONAR-4853
@@ -1711,12 +1720,12 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric LCOM4_DISTRIBUTION = new Metric.Builder(LCOM4_DISTRIBUTION_KEY, "Class distribution /LCOM4", Metric.ValueType.DISTRIB)
- .setDescription("Class distribution /LCOM4")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
- .create();
+ .setDescription("Class distribution /LCOM4")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
+ .create();
/**
* @deprecated in 4.1. See http://jira.codehaus.org/browse/SONAR-4853
@@ -1729,11 +1738,11 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric SUSPECT_LCOM4_DENSITY = new Metric.Builder(SUSPECT_LCOM4_DENSITY_KEY, "Suspect LCOM4 density", Metric.ValueType.PERCENT)
- .setDescription("Density of classes having LCOM4>1")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Density of classes having LCOM4>1")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
/**
* @deprecated since 3.7.1
@@ -1745,11 +1754,11 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric AFFERENT_COUPLINGS = new Metric.Builder(AFFERENT_COUPLINGS_KEY, "Afferent couplings", Metric.ValueType.INT)
- .setDescription("Afferent couplings")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Afferent couplings")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
/**
* @deprecated since 3.7.1
@@ -1761,122 +1770,122 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric EFFERENT_COUPLINGS = new Metric.Builder(EFFERENT_COUPLINGS_KEY, "Efferent couplings", Metric.ValueType.INT)
- .setDescription("Efferent couplings")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Efferent couplings")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String DEPENDENCY_MATRIX_KEY = "dsm";
public static final Metric DEPENDENCY_MATRIX = new Metric.Builder(DEPENDENCY_MATRIX_KEY, "Dependency Matrix", Metric.ValueType.DATA)
- .setDescription("Dependency Matrix")
- .setDirection(Metric.DIRECTION_NONE)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Dependency Matrix")
+ .setDirection(Metric.DIRECTION_NONE)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String PACKAGE_CYCLES_KEY = "package_cycles";
public static final Metric PACKAGE_CYCLES = new Metric.Builder(PACKAGE_CYCLES_KEY, "Package cycles", Metric.ValueType.INT)
- .setDescription("Package cycles")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setBestValue(0.0)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("Package cycles")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setBestValue(0.0)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String PACKAGE_TANGLE_INDEX_KEY = "package_tangle_index";
public static final Metric PACKAGE_TANGLE_INDEX = new Metric.Builder(PACKAGE_TANGLE_INDEX_KEY, "Package tangle index", Metric.ValueType.PERCENT)
- .setDescription("Package tangle index")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setBestValue(0.0)
- .setDomain(DOMAIN_DESIGN)
- .create();
+ .setDescription("Package tangle index")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setBestValue(0.0)
+ .setDomain(DOMAIN_DESIGN)
+ .create();
public static final String PACKAGE_TANGLES_KEY = "package_tangles";
public static final Metric PACKAGE_TANGLES = new Metric.Builder(PACKAGE_TANGLES_KEY, "File dependencies to cut", Metric.ValueType.INT)
- .setDescription("File dependencies to cut")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildValuesFormula(false))
- .create();
+ .setDescription("File dependencies to cut")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildValuesFormula(false))
+ .create();
public static final String PACKAGE_FEEDBACK_EDGES_KEY = "package_feedback_edges";
public static final Metric PACKAGE_FEEDBACK_EDGES = new Metric.Builder(PACKAGE_FEEDBACK_EDGES_KEY, "Package dependencies to cut", Metric.ValueType.INT)
- .setDescription("Package dependencies to cut")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildValuesFormula(false))
- .setBestValue(0.0)
- .create();
+ .setDescription("Package dependencies to cut")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildValuesFormula(false))
+ .setBestValue(0.0)
+ .create();
public static final String PACKAGE_EDGES_WEIGHT_KEY = "package_edges_weight";
public static final Metric PACKAGE_EDGES_WEIGHT = new Metric.Builder(PACKAGE_EDGES_WEIGHT_KEY, "Package edges weight", Metric.ValueType.INT)
- .setDescription("Package edges weight")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setFormula(new SumChildValuesFormula(false))
- .setHidden(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Package edges weight")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setFormula(new SumChildValuesFormula(false))
+ .setHidden(true)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String FILE_CYCLES_KEY = "file_cycles";
public static final Metric FILE_CYCLES = new Metric.Builder(FILE_CYCLES_KEY, "File cycles", Metric.ValueType.INT)
- .setDescription("File cycles")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .setDeleteHistoricalData(true)
- .setBestValue(0.0)
- .create();
+ .setDescription("File cycles")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .setDeleteHistoricalData(true)
+ .setBestValue(0.0)
+ .create();
public static final String FILE_TANGLE_INDEX_KEY = "file_tangle_index";
public static final Metric FILE_TANGLE_INDEX = new Metric.Builder(FILE_TANGLE_INDEX_KEY, "File tangle index", Metric.ValueType.PERCENT)
- .setDescription("File tangle index")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .setDeleteHistoricalData(true)
- .setBestValue(0.0)
- .create();
+ .setDescription("File tangle index")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .setDeleteHistoricalData(true)
+ .setBestValue(0.0)
+ .create();
public static final String FILE_TANGLES_KEY = "file_tangles";
public static final Metric FILE_TANGLES = new Metric.Builder(FILE_TANGLES_KEY, "File tangles", Metric.ValueType.INT)
- .setDescription("Files tangles")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("Files tangles")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .setDeleteHistoricalData(true)
+ .create();
public static final String FILE_FEEDBACK_EDGES_KEY = "file_feedback_edges";
public static final Metric FILE_FEEDBACK_EDGES = new Metric.Builder(FILE_FEEDBACK_EDGES_KEY, "Suspect file dependencies", Metric.ValueType.INT)
- .setDescription("Suspect file dependencies")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .setDeleteHistoricalData(true)
- .setBestValue(0.0)
- .create();
+ .setDescription("Suspect file dependencies")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .setDeleteHistoricalData(true)
+ .setBestValue(0.0)
+ .create();
public static final String FILE_EDGES_WEIGHT_KEY = "file_edges_weight";
public static final Metric FILE_EDGES_WEIGHT = new Metric.Builder(FILE_EDGES_WEIGHT_KEY, "File edges weight", Metric.ValueType.INT)
- .setDescription("File edges weight")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(false)
- .setDomain(DOMAIN_DESIGN)
- .setHidden(true)
- .setDeleteHistoricalData(true)
- .create();
+ .setDescription("File edges weight")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(false)
+ .setDomain(DOMAIN_DESIGN)
+ .setHidden(true)
+ .setDeleteHistoricalData(true)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -1898,8 +1907,8 @@ public final class CoreMetrics {
* @since 2.7
*/
public static final Metric SCM_AUTHORS_BY_LINE = new Metric.Builder(SCM_AUTHORS_BY_LINE_KEY, "Authors by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_SCM)
- .create();
+ .setDomain(DOMAIN_SCM)
+ .create();
/**
* @since 2.7
@@ -1914,8 +1923,8 @@ public final class CoreMetrics {
* @since 2.7
*/
public static final Metric SCM_REVISIONS_BY_LINE = new Metric.Builder(SCM_REVISIONS_BY_LINE_KEY, "Revisions by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_SCM)
- .create();
+ .setDomain(DOMAIN_SCM)
+ .create();
/**
* @since 2.7
@@ -1930,8 +1939,8 @@ public final class CoreMetrics {
* @since 2.7
*/
public static final Metric SCM_LAST_COMMIT_DATETIMES_BY_LINE = new Metric.Builder(SCM_LAST_COMMIT_DATETIMES_BY_LINE_KEY, "Last commit dates by line", Metric.ValueType.DATA)
- .setDomain(DOMAIN_SCM)
- .create();
+ .setDomain(DOMAIN_SCM)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -1952,13 +1961,13 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric UNREVIEWED_VIOLATIONS = new Metric.Builder(UNREVIEWED_VIOLATIONS_KEY, "Unreviewed violations", Metric.ValueType.INT)
- .setDescription("Violations that have not been reviewed yet")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_REVIEWS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setHidden(true)
- .create();
+ .setDescription("Violations that have not been reviewed yet")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_REVIEWS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setHidden(true)
+ .create();
/**
* @since 2.14
@@ -1973,15 +1982,15 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric NEW_UNREVIEWED_VIOLATIONS = new Metric.Builder(NEW_UNREVIEWED_VIOLATIONS_KEY, "New unreviewed violations", Metric.ValueType.INT)
- .setDescription("New violations that have not been reviewed yet")
- .setDirection(Metric.DIRECTION_WORST)
- .setQualitative(true)
- .setDomain(DOMAIN_REVIEWS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setDeleteHistoricalData(true)
- .setHidden(true)
- .create();
+ .setDescription("New violations that have not been reviewed yet")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(true)
+ .setDomain(DOMAIN_REVIEWS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setDeleteHistoricalData(true)
+ .setHidden(true)
+ .create();
/**
* @since 2.14
@@ -1996,13 +2005,13 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric FALSE_POSITIVE_REVIEWS = new Metric.Builder(FALSE_POSITIVE_REVIEWS_KEY, "False-positive reviews", Metric.ValueType.INT)
- .setDescription("Active false-positive reviews")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_REVIEWS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setHidden(true)
- .create();
+ .setDescription("Active false-positive reviews")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_REVIEWS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setHidden(true)
+ .create();
/**
* @since 2.14
@@ -2017,13 +2026,13 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric ACTIVE_REVIEWS = new Metric.Builder(ACTIVE_REVIEWS_KEY, "Active reviews", Metric.ValueType.INT)
- .setDescription("Active open and reopened reviews")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_REVIEWS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setHidden(true)
- .create();
+ .setDescription("Active open and reopened reviews")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_REVIEWS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setHidden(true)
+ .create();
/**
* @since 2.14
@@ -2038,13 +2047,13 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric UNASSIGNED_REVIEWS = new Metric.Builder(UNASSIGNED_REVIEWS_KEY, "Unassigned reviews", Metric.ValueType.INT)
- .setDescription("Active unassigned reviews")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_REVIEWS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setHidden(true)
- .create();
+ .setDescription("Active unassigned reviews")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_REVIEWS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setHidden(true)
+ .create();
/**
* @since 2.14
@@ -2059,14 +2068,13 @@ public final class CoreMetrics {
*/
@Deprecated
public static final Metric UNPLANNED_REVIEWS = new Metric.Builder(UNPLANNED_REVIEWS_KEY, "Unplanned reviews", Metric.ValueType.INT)
- .setDescription("Active unplanned reviews")
- .setDirection(Metric.DIRECTION_WORST)
- .setDomain(DOMAIN_REVIEWS)
- .setBestValue(0.0)
- .setOptimizedBestValue(true)
- .setHidden(true)
- .create();
-
+ .setDescription("Active unplanned reviews")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setDomain(DOMAIN_REVIEWS)
+ .setBestValue(0.0)
+ .setOptimizedBestValue(true)
+ .setHidden(true)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -2108,7 +2116,6 @@ public final class CoreMetrics {
.setDeleteHistoricalData(true)
.create();
-
// --------------------------------------------------------------------------------------------------------------------
//
// FILE DATA
@@ -2130,9 +2137,9 @@ public final class CoreMetrics {
*/
@Beta
public static final Metric NCLOC_DATA = new Metric.Builder(NCLOC_DATA_KEY, "ncloc_data", Metric.ValueType.DATA)
- .setHidden(true)
- .setDomain(DOMAIN_SIZE)
- .create();
+ .setHidden(true)
+ .setDomain(DOMAIN_SIZE)
+ .create();
/**
* @since 2.14
@@ -2149,9 +2156,9 @@ public final class CoreMetrics {
*/
@Beta
public static final Metric COMMENT_LINES_DATA = new Metric.Builder(COMMENT_LINES_DATA_KEY, "comment_lines_data", Metric.ValueType.DATA)
- .setHidden(true)
- .setDomain(DOMAIN_DOCUMENTATION)
- .create();
+ .setHidden(true)
+ .setDomain(DOMAIN_DOCUMENTATION)
+ .create();
// --------------------------------------------------------------------------------------------------------------------
//
@@ -2161,17 +2168,17 @@ public final class CoreMetrics {
public static final String ALERT_STATUS_KEY = "alert_status";
public static final Metric ALERT_STATUS = new Metric.Builder(ALERT_STATUS_KEY, "Alert", Metric.ValueType.LEVEL)
- .setDescription("Alert")
- .setDirection(Metric.DIRECTION_BETTER)
- .setQualitative(true)
- .setDomain(DOMAIN_GENERAL)
- .create();
+ .setDescription("Alert")
+ .setDirection(Metric.DIRECTION_BETTER)
+ .setQualitative(true)
+ .setDomain(DOMAIN_GENERAL)
+ .create();
public static final String PROFILE_KEY = "profile";
public static final Metric PROFILE = new Metric.Builder(PROFILE_KEY, "Profile", Metric.ValueType.DATA)
- .setDescription("Selected quality profile")
- .setDomain(DOMAIN_GENERAL)
- .create();
+ .setDescription("Selected quality profile")
+ .setDomain(DOMAIN_GENERAL)
+ .create();
/**
* @since 2.9
@@ -2182,11 +2189,11 @@ public final class CoreMetrics {
* @since 2.9
*/
public static final Metric PROFILE_VERSION = new Metric.Builder(PROFILE_VERSION_KEY, "Profile version", Metric.ValueType.INT)
- .setDescription("Selected quality profile version")
- .setQualitative(false)
- .setDomain(DOMAIN_GENERAL)
- .setHidden(true)
- .create();
+ .setDescription("Selected quality profile version")
+ .setQualitative(false)
+ .setDomain(DOMAIN_GENERAL)
+ .setHidden(true)
+ .create();
private static final List<Metric> METRICS;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
index b49dad1b640..fee9e1d0599 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
@@ -25,16 +25,15 @@ import org.sonar.api.utils.WildcardPattern;
/**
* @since 1.10
+ * Extends JavaPackage to allow smooth migration from JavaPackage to Directory
*/
-public class Directory extends Resource {
+public class Directory extends JavaPackage {
public static final String SEPARATOR = "/";
public static final String ROOT = "[root]";
- private Language language;
-
- private Directory() {
- // USed by factory
+ Directory() {
+ // Used by factory
}
/**
@@ -51,12 +50,11 @@ public class Directory extends Resource {
@Deprecated
public Directory(String deprecatedKey, Language language) {
setDeprecatedKey(parseKey(deprecatedKey));
- this.language = language;
}
@Override
public String getName() {
- return getDeprecatedKey();
+ return getKey();
}
@Override
@@ -71,7 +69,7 @@ public class Directory extends Resource {
@Override
public Language getLanguage() {
- return language;
+ return null;
}
@Override
@@ -99,12 +97,12 @@ public class Directory extends Resource {
if (StringUtils.isBlank(key)) {
return ROOT;
}
-
- key = key.replace('\\', '/');
- key = StringUtils.trim(key);
- key = StringUtils.removeStart(key, Directory.SEPARATOR);
- key = StringUtils.removeEnd(key, Directory.SEPARATOR);
- return key;
+ String normalizedKey = key;
+ normalizedKey = normalizedKey.replace('\\', '/');
+ normalizedKey = StringUtils.trim(normalizedKey);
+ normalizedKey = StringUtils.removeStart(normalizedKey, Directory.SEPARATOR);
+ normalizedKey = StringUtils.removeEnd(normalizedKey, Directory.SEPARATOR);
+ return normalizedKey;
}
public static Directory create(String path, String directoryDeprecatedKey) {
@@ -122,7 +120,6 @@ public class Directory extends Resource {
.append("key", getKey())
.append("deprecatedKey", getDeprecatedKey())
.append("path", getPath())
- .append("language", language)
.toString();
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
index 1972b72db8b..17134ed7754 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
@@ -121,10 +121,10 @@ public class File extends Resource {
if (StringUtils.isBlank(key)) {
return null;
}
-
- key = key.replace('\\', '/');
- key = StringUtils.trim(key);
- return key;
+ String normalizedKey = key;
+ normalizedKey = normalizedKey.replace('\\', '/');
+ normalizedKey = StringUtils.trim(normalizedKey);
+ return normalizedKey;
}
/**
@@ -177,7 +177,7 @@ public class File extends Resource {
*/
@Override
public String getLongName() {
- return getKey();
+ return StringUtils.defaultIfBlank(getPath(), getKey());
}
/**
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
index bb8471c82d5..92c01f93d80 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
@@ -222,7 +222,8 @@ public class JavaFile extends Resource {
javaFile.setKey(normalizedPath);
javaFile.setPath(normalizedPath);
String directoryKey = StringUtils.substringBeforeLast(normalizedPath, Directory.SEPARATOR);
- javaFile.parent = JavaPackage.create(directoryKey);
+ javaFile.parent = new Directory();
+ javaFile.parent.setKey(directoryKey);
return javaFile;
}
@@ -239,14 +240,15 @@ public class JavaFile extends Resource {
}
javaFile.fullyQualifiedName = javaFile.packageFullyQualifiedName + "." + javaFile.className;
javaFile.setDeprecatedKey(javaFile.fullyQualifiedName);
+ javaFile.parent.setDeprecatedKey(Directory.parseKey(StringUtils.substringBeforeLast(relativePathFromSourceDir, Directory.SEPARATOR)));
} else {
javaFile.packageFullyQualifiedName = JavaPackage.DEFAULT_PACKAGE_NAME;
javaFile.className = StringUtils.removeEndIgnoreCase(relativePathFromSourceDir, JAVA_SUFFIX);
javaFile.fullyQualifiedName = javaFile.className;
javaFile.setDeprecatedKey(JavaPackage.DEFAULT_PACKAGE_NAME + "." + javaFile.className);
+ javaFile.parent.setDeprecatedKey(Directory.ROOT);
}
javaFile.unitTest = unitTest;
- javaFile.parent.setDeprecatedKey(javaFile.packageFullyQualifiedName);
return javaFile;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
index 499d2706a58..356cf58a14e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java
@@ -22,13 +22,13 @@ package org.sonar.api.resources;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
-import javax.annotation.Nullable;
-
/**
* A class that represents a Java package in Sonar
*
* @since 1.10
+ * @deprecated since 4.2 use {@link Directory} instead
*/
+@Deprecated
public class JavaPackage extends Resource {
/**
@@ -51,14 +51,19 @@ public class JavaPackage extends Resource {
*/
@Deprecated
public JavaPackage(String deprecatedKey) {
- setDeprecatedKey(StringUtils.defaultIfEmpty(StringUtils.trim(deprecatedKey), DEFAULT_PACKAGE_NAME));
+ if (DEFAULT_PACKAGE_NAME.equals(deprecatedKey)) {
+ deprecatedKey = Directory.ROOT;
+ }
+ String deprecatedDirectoryKey = StringUtils.trimToEmpty(deprecatedKey);
+ deprecatedDirectoryKey = deprecatedDirectoryKey.replaceAll("\\.", Directory.SEPARATOR);
+ setDeprecatedKey(StringUtils.defaultIfEmpty(deprecatedDirectoryKey, Directory.ROOT));
}
/**
* @return whether the JavaPackage key is the default key
*/
public boolean isDefault() {
- return StringUtils.equals(getDeprecatedKey(), DEFAULT_PACKAGE_NAME);
+ return StringUtils.equals(getDeprecatedKey(), Directory.ROOT);
}
/**
@@ -90,7 +95,7 @@ public class JavaPackage extends Resource {
*/
@Override
public String getQualifier() {
- return Qualifiers.PACKAGE;
+ return Qualifiers.DIRECTORY;
}
/**
@@ -98,7 +103,7 @@ public class JavaPackage extends Resource {
*/
@Override
public String getName() {
- return getDeprecatedKey();
+ return getKey();
}
/**
@@ -118,28 +123,11 @@ public class JavaPackage extends Resource {
}
/**
- * @return Java
+ * @return null
*/
@Override
public Language getLanguage() {
- return Java.INSTANCE;
- }
-
- /**
- * For internal use only.
- */
- public static JavaPackage create(String path) {
- JavaPackage pac = new JavaPackage();
- String normalizedPath = normalize(path);
- pac.setKey(normalizedPath);
- pac.setPath(normalizedPath);
- return pac;
- }
-
- public static JavaPackage create(String relativePathFromBasedir, @Nullable String packageQualifiedName) {
- JavaPackage pac = JavaPackage.create(relativePathFromBasedir);
- pac.setDeprecatedKey(StringUtils.defaultIfEmpty(StringUtils.trim(packageQualifiedName), DEFAULT_PACKAGE_NAME));
- return pac;
+ return null;
}
@Override
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java
index 2f3f8c4250f..af59617bc51 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java
@@ -61,6 +61,10 @@ public final class Qualifiers {
*/
public static final String MODULE = "BRC";
+ /**
+ * @deprecated since 4.2 now packages are considered as regular directories. Use {@link #DIRECTORY} instead.
+ */
+ @Deprecated
public static final String PACKAGE = "PAC";
public static final String DIRECTORY = "DIR";
public static final String FILE = "FIL";
@@ -117,10 +121,11 @@ public final class Qualifiers {
}
/**
- * @param resource not nullable
+ * @deprecated since 4.2 Package is now a directory. Use {@link #isDirectory(Resource)}
*/
+ @Deprecated
public static boolean isPackage(final Resource resource) {
- return StringUtils.equals(PACKAGE, resource.getQualifier());
+ return StringUtils.equals(PACKAGE, resource.getQualifier()) || isDirectory(resource);
}
/**
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java
index 0bd6309a7e7..ef71123b843 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java
@@ -299,7 +299,11 @@ public abstract class Resource implements Serializable {
if (this == o) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
+ if (o == null) {
+ return false;
+ }
+ // JavaPackage and Directory are considered equivalent since 4.2
+ if (getClass() != o.getClass() && !(this instanceof JavaPackage && o instanceof JavaPackage)) {
return false;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java
index ae901e0bdfe..3676e50b140 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java
@@ -58,10 +58,11 @@ public final class ResourceUtils {
}
/**
- * @return whether a resource is a package
+ * @deprecated since 4.2 Package are now directory. Use {@link #isDirectory(Resource)}
*/
+ @Deprecated
public static boolean isPackage(Resource resource) {
- return resource != null && Qualifiers.PACKAGE.equals(resource.getQualifier());
+ return resource != null && Qualifiers.PACKAGE.equals(resource.getQualifier()) || isDirectory(resource);
}
/**
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/SquidUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/SquidUtilsTest.java
index de1448021d9..7313c4ca330 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/SquidUtilsTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/SquidUtilsTest.java
@@ -42,7 +42,7 @@ public class SquidUtilsTest {
@Test
public void shouldConvertJavaPackageKeyFromSquidFormat() {
- assertThat(new JavaPackage("java.lang")).isEqualTo(SquidUtils.convertJavaPackageKeyFromSquidFormat("java/lang"));
+ assertThat(new JavaPackage("java/lang")).isEqualTo(SquidUtils.convertJavaPackageKeyFromSquidFormat("java/lang"));
assertThat(new JavaPackage("")).isEqualTo(SquidUtils.convertJavaPackageKeyFromSquidFormat(""));
assertThat(new JavaPackage("singlepackage")).isEqualTo(SquidUtils.convertJavaPackageKeyFromSquidFormat("singlepackage"));
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/DirectoryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/DirectoryTest.java
index a5f673b1649..ef26a115023 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/DirectoryTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/DirectoryTest.java
@@ -32,14 +32,13 @@ public class DirectoryTest {
Resource dir = Directory.create("src/foo/bar/", " /foo/bar/ ");
assertThat(dir.getKey(), is("/src/foo/bar"));
assertThat(dir.getDeprecatedKey(), is("foo/bar"));
- assertThat(dir.getName(), is("foo/bar"));
+ assertThat(dir.getName(), is("/src/foo/bar"));
}
@Test
public void shouldNotStartOrEndBySlashDeprecatedConstructor() {
Resource dir = new Directory(" /foo/bar/ ");
assertThat(dir.getDeprecatedKey(), is("foo/bar"));
- assertThat(dir.getName(), is("foo/bar"));
}
@Test
@@ -53,7 +52,6 @@ public class DirectoryTest {
public void backSlashesShouldBeReplacedBySlashes() {
Resource dir = new Directory(" foo\\bar\\ ");
assertThat(dir.getDeprecatedKey(), is("foo/bar"));
- assertThat(dir.getName(), is("foo/bar"));
}
@Test
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
index 684d08aadd8..9dba526fb45 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
@@ -30,10 +30,7 @@ import java.util.List;
import static org.fest.assertions.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
public class JavaFileTest {
@@ -48,7 +45,7 @@ public class JavaFileTest {
assertThat(javaClass.getName(), is("Hello.java"));
assertThat(javaClass.getLongName(), is("org.foo.bar.Hello"));
assertThat(javaClass.getParent().getKey(), is("/src/main/java/org/foo/bar"));
- assertThat(javaClass.getParent().getDeprecatedKey(), is("org.foo.bar"));
+ assertThat(javaClass.getParent().getDeprecatedKey(), is("org/foo/bar"));
}
@Test
@@ -57,7 +54,7 @@ public class JavaFileTest {
assertThat(javaClass.getDeprecatedKey(), is("org.foo.bar.Hello"));
assertThat(javaClass.getName(), is("Hello.java"));
assertThat(javaClass.getLongName(), is("org.foo.bar.Hello"));
- assertThat(javaClass.getParent().getDeprecatedKey(), is("org.foo.bar"));
+ assertThat(javaClass.getParent().getDeprecatedKey(), is("org/foo/bar"));
}
@Test
@@ -66,7 +63,7 @@ public class JavaFileTest {
assertThat(javaClass.getDeprecatedKey(), is("org.foo.bar.Hello"));
assertThat(javaClass.getName(), is("Hello.java"));
assertThat(javaClass.getLongName(), is("org.foo.bar.Hello"));
- assertThat(javaClass.getParent().getDeprecatedKey(), is("org.foo.bar"));
+ assertThat(javaClass.getParent().getDeprecatedKey(), is("org/foo/bar"));
}
@Test
@@ -84,7 +81,7 @@ public class JavaFileTest {
assertThat(javaClass.getName(), is("Hello.java"));
assertThat(javaClass.getLongName(), is("Hello"));
assertThat(javaClass.getParent().getKey()).isEqualTo("/src/main/java");
- assertThat(javaClass.getParent().getDeprecatedKey()).isEqualTo(JavaPackage.DEFAULT_PACKAGE_NAME);
+ assertThat(javaClass.getParent().getDeprecatedKey()).isEqualTo(Directory.ROOT);
assertThat(javaClass.getParent().isDefault()).isTrue();
}
@@ -122,7 +119,7 @@ public class JavaFileTest {
assertThat(javaClass.getLongName(), is("org.foo.bar.Java"));
assertThat(javaClass.getName(), is("Java.java"));
JavaPackage parent = javaClass.getParent();
- assertEquals("org.foo.bar", parent.getDeprecatedKey());
+ assertEquals("org/foo/bar", parent.getDeprecatedKey());
}
@Test
@@ -132,19 +129,19 @@ public class JavaFileTest {
assertThat(clazz.getLongName(), is("org.foo.bar.Hello"));
assertThat(clazz.getName(), is("Hello.java"));
JavaPackage parent = clazz.getParent();
- assertThat(parent.getDeprecatedKey(), is("org.foo.bar"));
+ assertThat(parent.getDeprecatedKey(), is("org/foo/bar"));
}
@Test
public void testEqualsOnClasses() {
JavaFile class1 = new JavaFile("foo.bar", "Hello", false);
JavaFile class2 = new JavaFile("foo.bar.Hello", false);
- assertEquals(class1, class2);
+ assertThat(class1).isEqualTo(class2);
class1 = new JavaFile("NoPackage", false);
class2 = new JavaFile("NoPackage", false);
- assertEquals(class1, class2);
- assertEquals(class1, class1);
+ assertThat(class1).isEqualTo(class2);
+ assertThat(class1).isEqualTo(class1);
}
@Test
@@ -163,7 +160,6 @@ public class JavaFileTest {
assertEquals("onelevel.MyFile", javaFile.getDeprecatedKey());
assertEquals("MyFile.java", javaFile.getName());
assertEquals("onelevel", javaFile.getParent().getDeprecatedKey());
- assertEquals("onelevel", javaFile.getParent().getName());
assertThat(javaFile.getParent().isDefault(), is(false));
}
@@ -176,7 +172,7 @@ public class JavaFileTest {
assertThat("foo.bar.MyFile", is(javaFile.getDeprecatedKey()));
assertThat(javaFile.getLongName(), is("foo.bar.MyFile"));
assertThat(javaFile.getName(), is("MyFile.java"));
- assertThat(javaFile.getParent().getDeprecatedKey(), is("foo.bar"));
+ assertThat(javaFile.getParent().getDeprecatedKey(), is("foo/bar"));
}
@Test
@@ -189,55 +185,55 @@ public class JavaFileTest {
assertEquals(JavaPackage.DEFAULT_PACKAGE_NAME + ".MyClass", javaClass.getDeprecatedKey());
assertEquals("MyClass.java", javaClass.getName());
- assertThat((javaClass.getParent()).isDefault(), is(true));
+ assertThat((javaClass.getParent()).isDefault()).isEqualTo(true);
}
@Test
public void shouldResolveOnlyJavaFromAbsolutePath() {
File source1 = newDir("source1");
List<File> sources = Arrays.asList(source1);
- assertNull(JavaFile.fromAbsolutePath(absPath(source1, "foo/bar/my_file.sql"), sources, false));
+ assertThat(JavaFile.fromAbsolutePath(absPath(source1, "foo/bar/my_file.sql"), sources, false)).isNull();
}
@Test
public void shouldNotFailWhenResolvingUnknownClassFromAbsolutePath() {
File source1 = newDir("source1");
List<File> sources = Arrays.asList(source1);
- assertNull(JavaFile.fromAbsolutePath("/home/other/src/main/java/foo/bar/MyClass.java", sources, false));
+ assertThat(JavaFile.fromAbsolutePath("/home/other/src/main/java/foo/bar/MyClass.java", sources, false)).isNull();
}
@Test
public void shouldMatchFilePatterns() {
JavaFile clazz = JavaFile.create("src/main/java/org/sonar/commons/Foo.java", "org/sonar/commons/Foo.java", false);
- assertTrue(clazz.matchFilePattern("**/commons/**/*.java"));
- assertTrue(clazz.matchFilePattern("/**/commons/**/*.java"));
- assertTrue(clazz.matchFilePattern("/**/commons/**/*.*"));
- assertFalse(clazz.matchFilePattern("/**/sonar/*.java"));
- assertTrue(clazz.matchFilePattern("/src/main/java/org/*/commons/**/*.java"));
- assertTrue(clazz.matchFilePattern("src/main/java/org/sonar/commons/*"));
- assertTrue(clazz.matchFilePattern("src/main/java/org/sonar/**/*.java"));
- assertFalse(clazz.matchFilePattern("src/main/java/org/sonar/*"));
- assertFalse(clazz.matchFilePattern("src/main/java/org/sonar*/*"));
- assertTrue(clazz.matchFilePattern("src/main/java/org/**"));
- assertTrue(clazz.matchFilePattern("*src/main/java/org/sona?/co??ons/**.*"));
- assertFalse(clazz.matchFilePattern("src/main/java/org/sonar/core/**"));
- assertTrue(clazz.matchFilePattern("src/main/java/org/sonar/commons/Foo.java"));
- assertTrue(clazz.matchFilePattern("**/*Foo.java"));
- assertTrue(clazz.matchFilePattern("**/*Foo.*"));
- assertTrue(clazz.matchFilePattern("src/main/java/org/*/*/Foo.java"));
- assertTrue(clazz.matchFilePattern("src/main/java/org/**/**/Foo.java"));
- assertTrue(clazz.matchFilePattern("**/commons/**/*"));
- assertTrue(clazz.matchFilePattern("**/*"));
+ assertThat(clazz.matchFilePattern("**/commons/**/*.java")).isTrue();
+ assertThat(clazz.matchFilePattern("/**/commons/**/*.java")).isTrue();
+ assertThat(clazz.matchFilePattern("/**/commons/**/*.*")).isTrue();
+ assertThat(clazz.matchFilePattern("/**/sonar/*.java")).isFalse();
+ assertThat(clazz.matchFilePattern("src/main/java/org/*/commons/**/*.java")).isTrue();
+ assertThat(clazz.matchFilePattern("src/main/java/org/sonar/commons/*")).isTrue();
+ assertThat(clazz.matchFilePattern("src/main/java/org/sonar/**/*.java")).isTrue();
+ assertThat(clazz.matchFilePattern("src/main/java/org/sonar/*")).isFalse();
+ assertThat(clazz.matchFilePattern("src/main/java/org/sonar*/*")).isFalse();
+ assertThat(clazz.matchFilePattern("src/main/java/org/**")).isTrue();
+ assertThat(clazz.matchFilePattern("*src/main/java/org/sona?/co??ons/**.*")).isTrue();
+ assertThat(clazz.matchFilePattern("src/main/java/org/sonar/core/**")).isFalse();
+ assertThat(clazz.matchFilePattern("src/main/java/org/sonar/commons/Foo.java")).isTrue();
+ assertThat(clazz.matchFilePattern("**/*Foo.java")).isTrue();
+ assertThat(clazz.matchFilePattern("**/*Foo.*")).isTrue();
+ assertThat(clazz.matchFilePattern("src/main/java/org/*/*/Foo.java")).isTrue();
+ assertThat(clazz.matchFilePattern("src/main/java/org/**/**/Foo.java")).isTrue();
+ assertThat(clazz.matchFilePattern("**/commons/**/*")).isTrue();
+ assertThat(clazz.matchFilePattern("**/*")).isTrue();
}
// SONAR-4397
@Test
public void shouldMatchFilePatternsWhenNoPackage() {
JavaFile clazz = JavaFile.create("src/main/java/Foo.java", "Foo.java", false);
- assertTrue(clazz.matchFilePattern("**/*Foo.java"));
- assertTrue(clazz.matchFilePattern("**/*Foo.*"));
- assertTrue(clazz.matchFilePattern("**/*"));
- assertTrue(clazz.matchFilePattern("src/main/java/Foo*.*"));
+ assertThat(clazz.matchFilePattern("**/*Foo.java")).isTrue();
+ assertThat(clazz.matchFilePattern("**/*Foo.*")).isTrue();
+ assertThat(clazz.matchFilePattern("**/*")).isTrue();
+ assertThat(clazz.matchFilePattern("src/main/java/Foo*.*")).isTrue();
}
/**
@@ -246,14 +242,14 @@ public class JavaFileTest {
@Test
public void doNotMatchAPattern() {
JavaFile file = JavaFile.create("src/main/java/org/sonar/commons/Foo.java", "org/sonar/commons/Foo.java", false);
- assertFalse(file.matchFilePattern("**/*.aj"));
- assertTrue(file.matchFilePattern("**/*.java"));
+ assertThat(file.matchFilePattern("**/*.aj")).isFalse();
+ assertThat(file.matchFilePattern("**/*.java")).isTrue();
}
@Test
public void should_exclude_test_files() {
JavaFile unitTest = JavaFile.create("src/main/java/org/sonar/commons/Foo.java", "org/sonar/commons/Foo.java", true);
- assertTrue(unitTest.matchFilePattern("**/*"));
+ assertThat(unitTest.matchFilePattern("**/*")).isTrue();
}
private File newDir(String dirName) {
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java
index f2934b14478..9210a95ce5c 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java
@@ -28,37 +28,25 @@ import static org.junit.Assert.assertThat;
public class JavaPackageTest {
@Test
- public void defaultPackage() {
+ public void defaultPackageDeprecatedConstructor() {
assertEquals(new JavaPackage(), new JavaPackage());
- assertEquals(JavaPackage.DEFAULT_PACKAGE_NAME, new JavaPackage(null).getDeprecatedKey());
- assertEquals(JavaPackage.DEFAULT_PACKAGE_NAME, new JavaPackage(null).getName());
- assertEquals(JavaPackage.DEFAULT_PACKAGE_NAME, new JavaPackage("").getDeprecatedKey());
+ assertEquals(Directory.ROOT, new JavaPackage(null).getDeprecatedKey());
+ assertEquals(Directory.ROOT, new JavaPackage("").getDeprecatedKey());
assertThat(new JavaPackage(null).isDefault(), is(true));
}
@Test
- public void testNewPackage() {
- assertEquals(JavaPackage.create("src/foo/bar", " foo.bar "), JavaPackage.create("src/foo/bar", "foo.bar"));
- JavaPackage pac = JavaPackage.create("src/foo/bar", "foo.bar");
- assertEquals("/src/foo/bar", pac.getKey());
- assertEquals("foo.bar", pac.getDeprecatedKey());
- assertEquals("foo.bar", pac.getName());
- }
-
- @Test
public void testNewPackageDeprecatedConstructor() {
assertEquals(new JavaPackage(" foo.bar "), new JavaPackage("foo.bar"));
JavaPackage pac = new JavaPackage("foo.bar");
- assertEquals("foo.bar", pac.getDeprecatedKey());
- assertEquals("foo.bar", pac.getName());
+ assertEquals("foo/bar", pac.getDeprecatedKey());
}
@Test
- public void singleLevelPackage() {
+ public void singleLevelPackageDeprecatedConstructor() {
assertEquals(new JavaPackage("foo"), new JavaPackage("foo"));
JavaPackage pac = new JavaPackage("foo");
assertEquals("foo", pac.getDeprecatedKey());
- assertEquals("foo", pac.getName());
}
@Test