diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2020-02-04 09:17:43 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2020-02-11 20:46:11 +0100 |
commit | 5401ba28ca50f805f19a0e33852c5566f53f9175 (patch) | |
tree | f7c8937061061b0e4e655787c8d4616392802170 /sonar-plugin-api | |
parent | 49c4ddbfef30767bdf9d6c145cdf972a03ac8c5b (diff) | |
download | sonarqube-5401ba28ca50f805f19a0e33852c5566f53f9175.tar.gz sonarqube-5401ba28ca50f805f19a0e33852c5566f53f9175.zip |
SONAR-12962 Compute Security Review measures on new code
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java | 138 |
1 files changed, 88 insertions, 50 deletions
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 4e27d4c4ae2..e31e6e85d3d 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 @@ -423,12 +423,12 @@ public final class CoreMetrics { @Deprecated public static final Metric<String> FUNCTION_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FUNCTION_COMPLEXITY_DISTRIBUTION_KEY, "Function Distribution / Complexity", Metric.ValueType.DISTRIB) - .setDescription("Functions distribution /complexity") - .setDirection(Metric.DIRECTION_NONE) - .setQualitative(true) - .setDomain(DOMAIN_COMPLEXITY) - .setHidden(true) - .create(); + .setDescription("Functions distribution /complexity") + .setDirection(Metric.DIRECTION_NONE) + .setQualitative(true) + .setDomain(DOMAIN_COMPLEXITY) + .setHidden(true) + .create(); /** * @deprecated since 6.7 @@ -441,12 +441,12 @@ public final class CoreMetrics { @Deprecated public static final Metric<String> FILE_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FILE_COMPLEXITY_DISTRIBUTION_KEY, "File Distribution / Complexity", Metric.ValueType.DISTRIB) - .setDescription("Files distribution /complexity") - .setDirection(Metric.DIRECTION_NONE) - .setQualitative(true) - .setDomain(DOMAIN_COMPLEXITY) - .setHidden(true) - .create(); + .setDescription("Files distribution /complexity") + .setDirection(Metric.DIRECTION_NONE) + .setQualitative(true) + .setDomain(DOMAIN_COMPLEXITY) + .setHidden(true) + .create(); public static final String COGNITIVE_COMPLEXITY_KEY = "cognitive_complexity"; public static final Metric<Integer> COGNITIVE_COMPLEXITY = new Metric.Builder(COGNITIVE_COMPLEXITY_KEY, "Cognitive Complexity", Metric.ValueType.INT) @@ -758,13 +758,13 @@ public final class CoreMetrics { */ public static final Metric<Integer> NEW_DUPLICATED_LINES_DENSITY = new Metric.Builder(NEW_DUPLICATED_LINES_DENSITY_KEY, "Duplicated Lines on New Code", Metric.ValueType.PERCENT) - .setDescription("Duplicated lines on new code balanced by statements") - .setDirection(Metric.DIRECTION_WORST) - .setQualitative(true) - .setDomain(DOMAIN_DUPLICATIONS) - .setBestValue(0.0) - .setDeleteHistoricalData(true) - .create(); + .setDescription("Duplicated lines on new code balanced by statements") + .setDirection(Metric.DIRECTION_WORST) + .setQualitative(true) + .setDomain(DOMAIN_DUPLICATIONS) + .setBestValue(0.0) + .setDeleteHistoricalData(true) + .create(); /** * @deprecated since 4.5. Internal storage of duplication is not an API. @@ -1346,13 +1346,13 @@ public final class CoreMetrics { */ public static final Metric<Long> EFFORT_TO_REACH_MAINTAINABILITY_RATING_A = new Metric.Builder(EFFORT_TO_REACH_MAINTAINABILITY_RATING_A_KEY, "Effort to Reach Maintainability Rating A", Metric.ValueType.WORK_DUR) - .setDescription("Effort to reach maintainability rating A") - .setDomain(DOMAIN_MAINTAINABILITY) - .setDirection(Metric.DIRECTION_WORST) - .setQualitative(true) - .setBestValue(0.0) - .setOptimizedBestValue(true) - .create(); + .setDescription("Effort to reach maintainability rating A") + .setDomain(DOMAIN_MAINTAINABILITY) + .setDirection(Metric.DIRECTION_WORST) + .setQualitative(true) + .setBestValue(0.0) + .setOptimizedBestValue(true) + .create(); // -------------------------------------------------------------------------------------------------------------------- // @@ -1370,13 +1370,13 @@ public final class CoreMetrics { */ public static final Metric<Long> RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability Remediation Effort", Metric.ValueType.WORK_DUR) - .setDescription("Reliability Remediation Effort") - .setDomain(DOMAIN_RELIABILITY) - .setDirection(Metric.DIRECTION_WORST) - .setOptimizedBestValue(true) - .setBestValue(0.0) - .setQualitative(true) - .create(); + .setDescription("Reliability Remediation Effort") + .setDomain(DOMAIN_RELIABILITY) + .setDirection(Metric.DIRECTION_WORST) + .setOptimizedBestValue(true) + .setBestValue(0.0) + .setQualitative(true) + .create(); /** * @since 5.5 @@ -1388,14 +1388,14 @@ public final class CoreMetrics { */ public static final Metric<Long> NEW_RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability Remediation Effort on New Code", Metric.ValueType.WORK_DUR) - .setDescription("Reliability remediation effort on new code") - .setDomain(DOMAIN_RELIABILITY) - .setDirection(Metric.DIRECTION_WORST) - .setOptimizedBestValue(true) - .setBestValue(0.0) - .setQualitative(true) - .setDeleteHistoricalData(true) - .create(); + .setDescription("Reliability remediation effort on new code") + .setDomain(DOMAIN_RELIABILITY) + .setDirection(Metric.DIRECTION_WORST) + .setOptimizedBestValue(true) + .setBestValue(0.0) + .setQualitative(true) + .setDeleteHistoricalData(true) + .create(); /** * @since 5.5 @@ -1466,14 +1466,14 @@ public final class CoreMetrics { */ public static final Metric<Long> NEW_SECURITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_SECURITY_REMEDIATION_EFFORT_KEY, "Security Remediation Effort on New Code", Metric.ValueType.WORK_DUR) - .setDescription("Security remediation effort on new code") - .setDomain(DOMAIN_SECURITY) - .setDirection(Metric.DIRECTION_WORST) - .setOptimizedBestValue(true) - .setBestValue(0.0) - .setQualitative(true) - .setDeleteHistoricalData(true) - .create(); + .setDescription("Security remediation effort on new code") + .setDomain(DOMAIN_SECURITY) + .setDirection(Metric.DIRECTION_WORST) + .setOptimizedBestValue(true) + .setBestValue(0.0) + .setQualitative(true) + .setDeleteHistoricalData(true) + .create(); /** * @since 5.5 @@ -1511,7 +1511,6 @@ public final class CoreMetrics { .setWorstValue(5.0) .create(); - // -------------------------------------------------------------------------------------------------------------------- // // SECURITY REVIEW @@ -1538,6 +1537,26 @@ public final class CoreMetrics { /** * @since 8.2 */ + public static final String NEW_SECURITY_REVIEW_RATING_KEY = "new_security_review_rating"; + + /** + * @since 8.2 + */ + public static final Metric<Integer> NEW_SECURITY_REVIEW_RATING = new Metric.Builder(NEW_SECURITY_REVIEW_RATING_KEY, "Security Review Rating on New Code", + Metric.ValueType.RATING) + .setDescription("Security Review Rating on New Code") + .setDomain(DOMAIN_SECURITY_REVIEW) + .setDirection(Metric.DIRECTION_WORST) + .setDeleteHistoricalData(true) + .setOptimizedBestValue(true) + .setQualitative(true) + .setBestValue(1.0) + .setWorstValue(5.0) + .create(); + + /** + * @since 8.2 + */ public static final String SECURITY_HOTSPOTS_REVIEWED_KEY = "security_hotspots_reviewed"; /** @@ -1552,6 +1571,25 @@ public final class CoreMetrics { .setBestValue(100.0) .create(); + /** + * @since 8.2 + */ + public static final String NEW_SECURITY_HOTSPOTS_REVIEWED_KEY = "new_security_hotspots_reviewed"; + + /** + * @since 8.2 + */ + public static final Metric<Integer> NEW_SECURITY_HOTSPOTS_REVIEWED = new Metric.Builder(NEW_SECURITY_HOTSPOTS_REVIEWED_KEY, "Security Hotspots Reviewed on New Code", + Metric.ValueType.PERCENT) + .setDescription("Security Hotspots Reviewed on New Code") + .setDomain(DOMAIN_SECURITY_REVIEW) + .setDirection(Metric.DIRECTION_BETTER) + .setDeleteHistoricalData(true) + .setQualitative(true) + .setWorstValue(0.0) + .setBestValue(100.0) + .create(); + // -------------------------------------------------------------------------------------------------------------------- // // FILE DATA |