diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-02-29 14:32:25 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-02-29 15:34:50 +0100 |
commit | 08f6ba94574e741aa85acf5cca0b1b612f28c27e (patch) | |
tree | c2b7ae84cf49dec7887aca2281383cf650a8bc50 /sonar-plugin-api/src/main | |
parent | 48d5099ff593ac7ec66cbdf69572019cf952037d (diff) | |
download | sonarqube-08f6ba94574e741aa85acf5cca0b1b612f28c27e.tar.gz sonarqube-08f6ba94574e741aa85acf5cca0b1b612f28c27e.zip |
SONAR-7338 SONAR-7339 SONAR-7340 new metrics to count issues by type
Diffstat (limited to 'sonar-plugin-api/src/main')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java | 232 |
1 files changed, 183 insertions, 49 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 796c66d1a15..4a93c6bdae3 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 @@ -42,13 +42,30 @@ public final class CoreMetrics { public static String DOMAIN_COMPLEXITY = "Complexity"; public static String DOMAIN_DOCUMENTATION = "Documentation"; public static String DOMAIN_SCM = "SCM"; - public static String DOMAIN_ISSUES = "Issues"; public static String DOMAIN_GENERAL = "General"; public static String DOMAIN_DUPLICATION = "Duplication"; public static String DOMAIN_DESIGN = "Design"; /** + * SonarQube Quality Model + * @since 5.5 + */ + public static String DOMAIN_MAINTAINABILITY = "Maintainability"; + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static String DOMAIN_RELIABILITY = "Reliability"; + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static String DOMAIN_SECURITY = "Security"; + + /** * @since 4.0 */ public static String DOMAIN_TECHNICAL_DEBT = "Technical Debt"; @@ -365,21 +382,21 @@ public final class CoreMetrics { @Deprecated public static final Metric<String> 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) - .setHidden(true) - .create(); + .setDescription("Classes distribution /complexity") + .setDirection(Metric.DIRECTION_NONE) + .setQualitative(true) + .setDomain(DOMAIN_COMPLEXITY) + .setHidden(true) + .create(); public static final String FUNCTION_COMPLEXITY_DISTRIBUTION_KEY = "function_complexity_distribution"; public static final Metric<String> 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) - .create(); + .setDescription("Functions distribution /complexity") + .setDirection(Metric.DIRECTION_NONE) + .setQualitative(true) + .setDomain(DOMAIN_COMPLEXITY) + .create(); public static final String FILE_COMPLEXITY_DISTRIBUTION_KEY = "file_complexity_distribution"; public static final Metric<String> FILE_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FILE_COMPLEXITY_DISTRIBUTION_KEY, "Files distribution /complexity", Metric.ValueType.DISTRIB) @@ -886,12 +903,12 @@ public final class CoreMetrics { */ public static final Metric<Integer> 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) - .setBestValue(0.0) - .setDeleteHistoricalData(true) - .create(); + .setDescription("Uncovered branches by Integration Tests on new code") + .setDirection(Metric.DIRECTION_WORST) + .setDomain(DOMAIN_INTEGRATION_TESTS) + .setBestValue(0.0) + .setDeleteHistoricalData(true) + .create(); /** * @since 2.12 @@ -1113,12 +1130,12 @@ public final class CoreMetrics { @Deprecated public static final Metric<String> 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 @@ -1146,11 +1163,11 @@ public final class CoreMetrics { */ public static final Metric<Integer> 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) - .setDeleteHistoricalData(true) - .setHidden(true) - .create(); + .setDescription("New branches to cover by all tests") + .setDomain(DOMAIN_OVERALL_TESTS) + .setDeleteHistoricalData(true) + .setHidden(true) + .create(); /** * @since 3.3 @@ -1176,12 +1193,12 @@ public final class CoreMetrics { */ public static final Metric<Integer> 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) - .setBestValue(0.0) - .setDeleteHistoricalData(true) - .create(); + .setDescription("New branches that are not covered by any test") + .setDirection(Metric.DIRECTION_WORST) + .setDomain(DOMAIN_OVERALL_TESTS) + .setBestValue(0.0) + .setDeleteHistoricalData(true) + .create(); /** * @since 3.3 @@ -1210,14 +1227,14 @@ public final class CoreMetrics { */ public static final Metric<Double> NEW_OVERALL_BRANCH_COVERAGE = new Metric.Builder(NEW_OVERALL_BRANCH_COVERAGE_KEY, "Overall condition coverage on new code", Metric.ValueType.PERCENT) - .setDescription("Condition 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("Condition 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 @@ -1251,10 +1268,10 @@ public final class CoreMetrics { @Deprecated public static final Metric<String> 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(); + .setDescription("Overall covered branches by all tests and by line") + .setDomain(DOMAIN_OVERALL_TESTS) + .setDeleteHistoricalData(true) + .create(); // -------------------------------------------------------------------------------------------------------------------- // @@ -1539,6 +1556,123 @@ public final class CoreMetrics { .setOptimizedBestValue(true) .create(); + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final String CODE_SMELLS_KEY = "code_smells"; + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final Metric<Integer> CODE_SMELLS = new Metric.Builder(CODE_SMELLS_KEY, "Code Smells", Metric.ValueType.INT) + .setDescription("Code Smells") + .setDirection(Metric.DIRECTION_WORST) + .setQualitative(false) + .setDomain(DOMAIN_MAINTAINABILITY) + .setBestValue(0.0) + .setOptimizedBestValue(true) + .create(); + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final String NEW_CODE_SMELLS_KEY = "new_code_smells"; + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final Metric<Integer> NEW_CODE_SMELLS = new Metric.Builder(NEW_CODE_SMELLS_KEY, "New code smells", Metric.ValueType.INT) + .setDescription("New Code Smells") + .setDirection(Metric.DIRECTION_WORST) + .setQualitative(true) + .setDomain(DOMAIN_MAINTAINABILITY) + .setBestValue(0.0) + .setOptimizedBestValue(true) + .setDeleteHistoricalData(true) + .create(); + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final String BUGS_KEY = "bugs"; + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final Metric<Integer> BUGS = new Metric.Builder(BUGS_KEY, "Bugs", Metric.ValueType.INT) + .setDescription("Bugs") + .setDirection(Metric.DIRECTION_WORST) + .setQualitative(false) + .setDomain(DOMAIN_RELIABILITY) + .setBestValue(0.0) + .setOptimizedBestValue(true) + .create(); + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final String NEW_BUGS_KEY = "new_bugs"; + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final Metric<Integer> NEW_BUGS = new Metric.Builder(NEW_BUGS_KEY, "New Bugs", Metric.ValueType.INT) + .setDescription("New Bugs") + .setDirection(Metric.DIRECTION_WORST) + .setQualitative(true) + .setDomain(DOMAIN_RELIABILITY) + .setBestValue(0.0) + .setOptimizedBestValue(true) + .setDeleteHistoricalData(true) + .create(); + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final String VULNERABILITIES_KEY = "vulnerabilities"; + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final Metric<Integer> VULNERABILITIES = new Metric.Builder(VULNERABILITIES_KEY, "Vulnerabilities", Metric.ValueType.INT) + .setDescription("Vulnerabilities") + .setDirection(Metric.DIRECTION_WORST) + .setQualitative(false) + .setDomain(DOMAIN_SECURITY) + .setBestValue(0.0) + .setOptimizedBestValue(true) + .create(); + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final String NEW_VULNERABILITIES_KEY = "new_vulnerabilities"; + + /** + * SonarQube Quality Model + * @since 5.5 + */ + public static final Metric<Integer> NEW_VULNERABILITIES = new Metric.Builder(NEW_VULNERABILITIES_KEY, "New Vulnerabilities", Metric.ValueType.INT) + .setDescription("New Vulnerabilities") + .setDirection(Metric.DIRECTION_WORST) + .setQualitative(true) + .setDomain(DOMAIN_SECURITY) + .setBestValue(0.0) + .setOptimizedBestValue(true) + .setDeleteHistoricalData(true) + .create(); + // -------------------------------------------------------------------------------------------------------------------- // // DESIGN @@ -2003,8 +2137,8 @@ public final class CoreMetrics { @Deprecated public static final transient Metric<String> 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(); // -------------------------------------------------------------------------------------------------------------------- // |