001/* 002 * SonarQube 003 * Copyright (C) 2009-2016 SonarSource SA 004 * mailto:contact AT sonarsource DOT com 005 * 006 * This program is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020package org.sonar.api.measures; 021 022import java.lang.reflect.Field; 023import java.lang.reflect.Modifier; 024import java.util.LinkedList; 025import java.util.List; 026import java.util.NoSuchElementException; 027import org.sonar.api.test.MutableTestPlan; 028import org.sonar.api.utils.SonarException; 029 030/** 031 * @since 1.10 032 */ 033public final class CoreMetrics { 034 035 // the following fields are not final to avoid compile-time constants used by plugins 036 public static String DOMAIN_SIZE = "Size"; 037 public static String DOMAIN_COVERAGE = "Coverage"; 038 039 /** 040 * @deprecated in 5.5. Merged into {@link #DOMAIN_COVERAGE} 041 */ 042 @Deprecated 043 public static String DOMAIN_TESTS = "Tests"; 044 045 /** 046 * @deprecated in 5.5. Merged into {@link #DOMAIN_COVERAGE} 047 */ 048 @Deprecated 049 public static String DOMAIN_INTEGRATION_TESTS = "Tests (Integration)"; 050 051 /** 052 * @deprecated in 5.5. Merged into {@link #DOMAIN_COVERAGE} 053 */ 054 @Deprecated 055 public static String DOMAIN_OVERALL_TESTS = "Tests (Overall)"; 056 public static String DOMAIN_COMPLEXITY = "Complexity"; 057 /** 058 * @deprecated since 6.2. Merged into {@link #DOMAIN_SIZE} 059 */ 060 @Deprecated 061 public static String DOMAIN_DOCUMENTATION = "Documentation"; 062 public static String DOMAIN_SCM = "SCM"; 063 public static String DOMAIN_ISSUES = "Issues"; 064 public static String DOMAIN_GENERAL = "General"; 065 public static String DOMAIN_DUPLICATIONS = "Duplications"; 066 067 /** 068 * @deprecated in 5.5. Renamed to {@link #DOMAIN_DUPLICATIONS} 069 */ 070 @Deprecated 071 public static String DOMAIN_DUPLICATION = "Duplication"; 072 public static String DOMAIN_DESIGN = "Design"; 073 074 /** 075 * SonarQube Quality Model 076 * @since 5.5 077 */ 078 public static String DOMAIN_MAINTAINABILITY = "Maintainability"; 079 080 /** 081 * SonarQube Quality Model 082 * @since 5.5 083 */ 084 public static String DOMAIN_RELIABILITY = "Reliability"; 085 086 /** 087 * SonarQube Quality Model 088 * @since 5.5 089 */ 090 public static String DOMAIN_SECURITY = "Security"; 091 092 /** 093 * @since 4.0 094 * 095 * @deprecated in 5.5. Replaced by {@link #DOMAIN_MAINTAINABILITY} 096 */ 097 @Deprecated 098 public static String DOMAIN_TECHNICAL_DEBT = "Technical Debt"; 099 100 /** 101 * @since 5.5 102 */ 103 public static String DOMAIN_RELEASABILITY = "Releasability"; 104 105 /** 106 * Computed by the platform since SQ 5.1 107 */ 108 public static final String LINES_KEY = "lines"; 109 public static final Metric<Integer> LINES = new Metric.Builder(LINES_KEY, "Lines", Metric.ValueType.INT) 110 .setDescription("Lines") 111 .setDirection(Metric.DIRECTION_WORST) 112 .setQualitative(false) 113 .setDomain(DOMAIN_SIZE) 114 .create(); 115 116 public static final String GENERATED_LINES_KEY = "generated_lines"; 117 public static final Metric<Integer> GENERATED_LINES = new Metric.Builder(GENERATED_LINES_KEY, "Generated Lines", Metric.ValueType.INT) 118 .setDescription("Number of generated lines") 119 .setDirection(Metric.DIRECTION_WORST) 120 .setQualitative(false) 121 .setDomain(DOMAIN_SIZE) 122 .setBestValue(0.0) 123 .setOptimizedBestValue(true) 124 .create(); 125 126 public static final String NCLOC_KEY = "ncloc"; 127 public static final Metric<Integer> NCLOC = new Metric.Builder(NCLOC_KEY, "Lines of Code", Metric.ValueType.INT) 128 .setDescription("Non commenting lines of code") 129 .setDirection(Metric.DIRECTION_WORST) 130 .setQualitative(false) 131 .setDomain(DOMAIN_SIZE) 132 .create(); 133 134 /** 135 * @since 6.1 136 */ 137 public static final String NEW_LINES_KEY = "new_lines"; 138 /** 139 * @since 6.1 140 */ 141 public static final Metric<Integer> NEW_LINES = new Metric.Builder(NEW_LINES_KEY, "Lines on New Code", Metric.ValueType.INT) 142 .setDescription("Non commenting lines on new code") 143 .setDirection(Metric.DIRECTION_WORST) 144 .setQualitative(false) 145 .setDomain(DOMAIN_SIZE) 146 .setDeleteHistoricalData(true) 147 .create(); 148 149 /** 150 * @since 4.4 151 */ 152 public static final String NCLOC_LANGUAGE_DISTRIBUTION_KEY = "ncloc_language_distribution"; 153 154 /** 155 * @since 4.4 156 */ 157 public static final Metric<String> NCLOC_LANGUAGE_DISTRIBUTION = new Metric.Builder(NCLOC_LANGUAGE_DISTRIBUTION_KEY, "Lines of Code Per Language", Metric.ValueType.DATA) 158 .setDescription("Non Commenting Lines of Code Distributed By Language") 159 .setDirection(Metric.DIRECTION_WORST) 160 .setQualitative(false) 161 .setDomain(DOMAIN_SIZE) 162 .create(); 163 164 public static final String GENERATED_NCLOC_KEY = "generated_ncloc"; 165 public static final Metric<Integer> GENERATED_NCLOC = new Metric.Builder(GENERATED_NCLOC_KEY, "Generated Lines of Code", Metric.ValueType.INT) 166 .setDescription("Generated non Commenting Lines of Code") 167 .setDirection(Metric.DIRECTION_WORST) 168 .setQualitative(false) 169 .setDomain(DOMAIN_SIZE) 170 .setBestValue(0.0) 171 .setOptimizedBestValue(true) 172 .create(); 173 174 public static final String CLASSES_KEY = "classes"; 175 public static final Metric<Integer> CLASSES = new Metric.Builder(CLASSES_KEY, "Classes", Metric.ValueType.INT) 176 .setDescription("Classes") 177 .setDirection(Metric.DIRECTION_WORST) 178 .setQualitative(false) 179 .setDomain(DOMAIN_SIZE) 180 .create(); 181 182 public static final String FILES_KEY = "files"; 183 /** 184 * Computed by the platform. 185 */ 186 public static final Metric<Integer> FILES = new Metric.Builder(FILES_KEY, "Files", Metric.ValueType.INT) 187 .setDescription("Number of files") 188 .setDirection(Metric.DIRECTION_WORST) 189 .setQualitative(false) 190 .setDomain(DOMAIN_SIZE) 191 .create(); 192 193 public static final String DIRECTORIES_KEY = "directories"; 194 /** 195 * Computed by the platform. 196 */ 197 public static final Metric<Integer> DIRECTORIES = new Metric.Builder(DIRECTORIES_KEY, "Directories", Metric.ValueType.INT) 198 .setDescription("Directories") 199 .setDirection(Metric.DIRECTION_WORST) 200 .setQualitative(false) 201 .setDomain(DOMAIN_SIZE) 202 .create(); 203 204 public static final String FUNCTIONS_KEY = "functions"; 205 public static final Metric<Integer> FUNCTIONS = new Metric.Builder(FUNCTIONS_KEY, "Functions", Metric.ValueType.INT) 206 .setDescription("Functions") 207 .setDirection(Metric.DIRECTION_WORST) 208 .setQualitative(false) 209 .setDomain(DOMAIN_SIZE) 210 .create(); 211 212 /** 213 * @deprecated since 5.0. 214 * @see <a href="https://jira.sonarsource.com/browse/SONAR-5224">SONAR-5224</a> 215 */ 216 @Deprecated 217 public static final String ACCESSORS_KEY = "accessors"; 218 219 /** 220 * @deprecated since 5.0. 221 * @see <a href="https://jira.sonarsource.com/browse/SONAR-5224">SONAR-5224</a> 222 */ 223 @Deprecated 224 public static final Metric<Integer> ACCESSORS = new Metric.Builder(ACCESSORS_KEY, "Accessors", Metric.ValueType.INT) 225 .setDescription("Accessors") 226 .setDirection(Metric.DIRECTION_WORST) 227 .setQualitative(false) 228 .setDomain(DOMAIN_SIZE) 229 .setHidden(true) 230 .create(); 231 232 public static final String STATEMENTS_KEY = "statements"; 233 public static final Metric<Integer> STATEMENTS = new Metric.Builder(STATEMENTS_KEY, "Statements", Metric.ValueType.INT) 234 .setDescription("Number of statements") 235 .setDirection(Metric.DIRECTION_WORST) 236 .setQualitative(false) 237 .setDomain(DOMAIN_SIZE) 238 .create(); 239 240 /** 241 * @deprecated since 6.2 242 * @see <a href="https://jira.sonarsource.com/browse/SONAR-8328">SONAR-8328</a> 243 */ 244 @Deprecated 245 public static final String PUBLIC_API_KEY = "public_api"; 246 public static final Metric<Integer> PUBLIC_API = new Metric.Builder(PUBLIC_API_KEY, "Public API", Metric.ValueType.INT) 247 .setDescription("Public API") 248 .setDirection(Metric.DIRECTION_WORST) 249 .setQualitative(false) 250 .setDomain(DOMAIN_DOCUMENTATION) 251 .setHidden(true) 252 .create(); 253 254 /** 255 * @since 3.0 256 */ 257 public static final String PROJECTS_KEY = "projects"; 258 259 /** 260 * @since 3.0 261 */ 262 public static final Metric<Integer> PROJECTS = new Metric.Builder(PROJECTS_KEY, "Projects", Metric.ValueType.INT) 263 .setDescription("Number of projects") 264 .setDirection(Metric.DIRECTION_WORST) 265 .setQualitative(false) 266 .setDomain(DOMAIN_SIZE) 267 .create(); 268 269 /** 270 * Moved to Size domain since 6.2 271 */ 272 public static final String COMMENT_LINES_KEY = "comment_lines"; 273 public static final Metric<Integer> COMMENT_LINES = new Metric.Builder(COMMENT_LINES_KEY, "Comment Lines", Metric.ValueType.INT) 274 .setDescription("Number of comment lines") 275 .setDirection(Metric.DIRECTION_BETTER) 276 .setQualitative(false) 277 .setDomain(DOMAIN_SIZE) 278 .create(); 279 280 /** 281 * Moved to Size domain since 6.2 282 */ 283 public static final String COMMENT_LINES_DENSITY_KEY = "comment_lines_density"; 284 public static final Metric<Double> COMMENT_LINES_DENSITY = new Metric.Builder(COMMENT_LINES_DENSITY_KEY, "Comments (%)", Metric.ValueType.PERCENT) 285 .setDescription("Comments balanced by ncloc + comment lines") 286 .setDirection(Metric.DIRECTION_BETTER) 287 .setQualitative(true) 288 .setDomain(DOMAIN_SIZE) 289 .create(); 290 291 // -------------------------------------------------------------------------------------------------------------------- 292 // 293 // DOCUMENTATION 294 // 295 // -------------------------------------------------------------------------------------------------------------------- 296 297 /** 298 * @deprecated since 6.2 299 * @see <a href="https://jira.sonarsource.com/browse/SONAR-8328">SONAR-8328</a> 300 */ 301 @Deprecated 302 public static final String PUBLIC_DOCUMENTED_API_DENSITY_KEY = "public_documented_api_density"; 303 public static final Metric<Double> PUBLIC_DOCUMENTED_API_DENSITY = new Metric.Builder(PUBLIC_DOCUMENTED_API_DENSITY_KEY, "Public Documented API (%)", Metric.ValueType.PERCENT) 304 .setDescription("Public documented classes and functions balanced by ncloc") 305 .setDirection(Metric.DIRECTION_BETTER) 306 .setQualitative(true) 307 .setDomain(DOMAIN_DOCUMENTATION) 308 .setWorstValue(0.0) 309 .setBestValue(100.0) 310 .setOptimizedBestValue(true) 311 .setHidden(true) 312 .create(); 313 314 /** 315 * @deprecated since 6.2 316 * @see <a href="https://jira.sonarsource.com/browse/SONAR-8328">SONAR-8328</a> 317 */ 318 @Deprecated 319 public static final String PUBLIC_UNDOCUMENTED_API_KEY = "public_undocumented_api"; 320 public static final Metric<Integer> PUBLIC_UNDOCUMENTED_API = new Metric.Builder(PUBLIC_UNDOCUMENTED_API_KEY, "Public Undocumented API", Metric.ValueType.INT) 321 .setDescription("Public undocumented classes, functions and variables") 322 .setDirection(Metric.DIRECTION_WORST) 323 .setQualitative(true) 324 .setDomain(DOMAIN_DOCUMENTATION) 325 .setBestValue(0.0) 326 .setDirection(Metric.DIRECTION_WORST) 327 .setOptimizedBestValue(true) 328 .setHidden(true) 329 .create(); 330 331 /** 332 * @deprecated since 4.2 - see SONAR-4990 333 */ 334 @Deprecated 335 public static final String COMMENTED_OUT_CODE_LINES_KEY = "commented_out_code_lines"; 336 337 /** 338 * @deprecated since 4.2 - see SONAR-4990 339 */ 340 @Deprecated 341 public static final Metric<Integer> COMMENTED_OUT_CODE_LINES = new Metric.Builder(COMMENTED_OUT_CODE_LINES_KEY, "Commented-Out LOC", Metric.ValueType.INT) 342 .setDescription("Commented lines of code") 343 .setDirection(Metric.DIRECTION_WORST) 344 .setQualitative(true) 345 .setDomain(DOMAIN_DOCUMENTATION) 346 .setBestValue(0.0) 347 .setOptimizedBestValue(true) 348 .setHidden(true) 349 .create(); 350 351 // -------------------------------------------------------------------------------------------------------------------- 352 // 353 // COMPLEXITY 354 // 355 // -------------------------------------------------------------------------------------------------------------------- 356 357 public static final String COMPLEXITY_KEY = "complexity"; 358 public static final Metric<Integer> COMPLEXITY = new Metric.Builder(COMPLEXITY_KEY, "Complexity", Metric.ValueType.INT) 359 .setDescription("Cyclomatic complexity") 360 .setDirection(Metric.DIRECTION_WORST) 361 .setQualitative(false) 362 .setDomain(DOMAIN_COMPLEXITY) 363 .create(); 364 365 public static final String FILE_COMPLEXITY_KEY = "file_complexity"; 366 public static final Metric<Double> FILE_COMPLEXITY = new Metric.Builder(FILE_COMPLEXITY_KEY, "Complexity / File", Metric.ValueType.FLOAT) 367 .setDescription("Complexity average by file") 368 .setDirection(Metric.DIRECTION_WORST) 369 .setQualitative(true) 370 .setDomain(DOMAIN_COMPLEXITY) 371 .create(); 372 373 /** 374 * @since 3.6 375 */ 376 public static final String COMPLEXITY_IN_CLASSES_KEY = "complexity_in_classes"; 377 378 /** 379 * @since 3.6 380 */ 381 public static final Metric<Integer> COMPLEXITY_IN_CLASSES = new Metric.Builder(COMPLEXITY_IN_CLASSES_KEY, "Complexity in Classes", Metric.ValueType.INT) 382 .setDescription("Cyclomatic complexity in classes") 383 .setHidden(true) 384 .setDirection(Metric.DIRECTION_WORST) 385 .setQualitative(false) 386 .setDomain(DOMAIN_COMPLEXITY) 387 .setDeleteHistoricalData(true) 388 .create(); 389 390 public static final String CLASS_COMPLEXITY_KEY = "class_complexity"; 391 392 /** 393 * Information about the cyclomatic complexity per class, calculated by divided the complexity in classes by the number of classes. 394 * If the complexity in classes is not available, the complexity of the file is used. 395 */ 396 public static final Metric<Double> CLASS_COMPLEXITY = new Metric.Builder(CLASS_COMPLEXITY_KEY, "Complexity / Class", Metric.ValueType.FLOAT) 397 .setDescription("Complexity average by class") 398 .setDirection(Metric.DIRECTION_WORST) 399 .setQualitative(true) 400 .setDomain(DOMAIN_COMPLEXITY) 401 .create(); 402 403 /** 404 * @since 3.6 405 */ 406 public static final String COMPLEXITY_IN_FUNCTIONS_KEY = "complexity_in_functions"; 407 408 /** 409 * @since 3.6 410 */ 411 public static final Metric<Integer> COMPLEXITY_IN_FUNCTIONS = new Metric.Builder(COMPLEXITY_IN_FUNCTIONS_KEY, "Complexity in Functions", Metric.ValueType.INT) 412 .setDescription("Cyclomatic complexity in functions") 413 .setHidden(true) 414 .setDirection(Metric.DIRECTION_WORST) 415 .setQualitative(false) 416 .setDomain(DOMAIN_COMPLEXITY) 417 .setDeleteHistoricalData(true) 418 .create(); 419 420 public static final String FUNCTION_COMPLEXITY_KEY = "function_complexity"; 421 422 /** 423 * Information about the cyclomatic complexity per function, calculated by divided the complexity in functions by the number of functions. 424 * If the complexity in functions is not available, the complexity of the file is used. 425 */ 426 public static final Metric<Double> FUNCTION_COMPLEXITY = new Metric.Builder(FUNCTION_COMPLEXITY_KEY, "Complexity / Function", Metric.ValueType.FLOAT) 427 .setDescription("Complexity average by function") 428 .setDirection(Metric.DIRECTION_WORST) 429 .setQualitative(true) 430 .setDomain(DOMAIN_COMPLEXITY) 431 .create(); 432 433 /** 434 * @deprecated in 3.0 - see SONAR-3289 435 */ 436 @Deprecated 437 public static final String CLASS_COMPLEXITY_DISTRIBUTION_KEY = "class_complexity_distribution"; 438 439 /** 440 * @deprecated in 3.0 - see SONAR-3289 441 */ 442 @Deprecated 443 public static final Metric<String> CLASS_COMPLEXITY_DISTRIBUTION = new Metric.Builder(CLASS_COMPLEXITY_DISTRIBUTION_KEY, "Class Distribution / Complexity", 444 Metric.ValueType.DISTRIB) 445 .setDescription("Classes distribution /complexity") 446 .setDirection(Metric.DIRECTION_NONE) 447 .setQualitative(true) 448 .setDomain(DOMAIN_COMPLEXITY) 449 .setHidden(true) 450 .create(); 451 452 public static final String FUNCTION_COMPLEXITY_DISTRIBUTION_KEY = "function_complexity_distribution"; 453 public static final Metric<String> FUNCTION_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FUNCTION_COMPLEXITY_DISTRIBUTION_KEY, "Function Distribution / Complexity", 454 Metric.ValueType.DISTRIB) 455 .setDescription("Functions distribution /complexity") 456 .setDirection(Metric.DIRECTION_NONE) 457 .setQualitative(true) 458 .setDomain(DOMAIN_COMPLEXITY) 459 .create(); 460 461 public static final String FILE_COMPLEXITY_DISTRIBUTION_KEY = "file_complexity_distribution"; 462 public static final Metric<String> FILE_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FILE_COMPLEXITY_DISTRIBUTION_KEY, "File Distribution / Complexity", 463 Metric.ValueType.DISTRIB) 464 .setDescription("Files distribution /complexity") 465 .setDirection(Metric.DIRECTION_NONE) 466 .setQualitative(true) 467 .setDomain(DOMAIN_COMPLEXITY) 468 .create(); 469 470 // -------------------------------------------------------------------------------------------------------------------- 471 // 472 // UNIT TESTS 473 // 474 // -------------------------------------------------------------------------------------------------------------------- 475 476 public static final String TESTS_KEY = "tests"; 477 478 /** 479 * Value of measure for this metric can be saved from Sensor, taking into account following rules: 480 * <ul> 481 * <li>Non-zero value should be saved for resources representing tests. And Sonar provides default Decorator, which will decorate parent resources.</li> 482 * <li>Should include {@link #TEST_FAILURES} and {@link #TEST_ERRORS}, but should not include {@link #SKIPPED_TESTS}.</li> 483 * </ul> 484 */ 485 public static final Metric<Integer> TESTS = new Metric.Builder(TESTS_KEY, "Unit Tests", Metric.ValueType.INT) 486 .setDescription("Number of unit tests") 487 .setDirection(Metric.DIRECTION_WORST) 488 .setQualitative(false) 489 .setDomain(DOMAIN_COVERAGE) 490 .create(); 491 492 public static final String TEST_EXECUTION_TIME_KEY = "test_execution_time"; 493 public static final Metric<Long> TEST_EXECUTION_TIME = new Metric.Builder(TEST_EXECUTION_TIME_KEY, "Unit Test Duration", Metric.ValueType.MILLISEC) 494 .setDescription("Execution duration of unit tests") 495 .setDirection(Metric.DIRECTION_WORST) 496 .setQualitative(false) 497 .setDomain(DOMAIN_COVERAGE) 498 .create(); 499 500 public static final String TEST_ERRORS_KEY = "test_errors"; 501 public static final Metric<Integer> TEST_ERRORS = new Metric.Builder(TEST_ERRORS_KEY, "Unit Test Errors", Metric.ValueType.INT) 502 .setDescription("Number of unit test errors") 503 .setDirection(Metric.DIRECTION_WORST) 504 .setQualitative(true) 505 .setDomain(DOMAIN_COVERAGE) 506 .setBestValue(0.0) 507 .setOptimizedBestValue(true) 508 .create(); 509 510 public static final String SKIPPED_TESTS_KEY = "skipped_tests"; 511 public static final Metric<Integer> SKIPPED_TESTS = new Metric.Builder(SKIPPED_TESTS_KEY, "Skipped Unit Tests", Metric.ValueType.INT) 512 .setDescription("Number of skipped unit tests") 513 .setDirection(Metric.DIRECTION_WORST) 514 .setQualitative(true) 515 .setDomain(DOMAIN_COVERAGE) 516 .setBestValue(0.0) 517 .setOptimizedBestValue(true) 518 .create(); 519 520 public static final String TEST_FAILURES_KEY = "test_failures"; 521 public static final Metric<Integer> TEST_FAILURES = new Metric.Builder(TEST_FAILURES_KEY, "Unit Test Failures", Metric.ValueType.INT) 522 .setDescription("Number of unit test failures") 523 .setDirection(Metric.DIRECTION_WORST) 524 .setQualitative(true) 525 .setDomain(DOMAIN_COVERAGE) 526 .setBestValue(0.0) 527 .setOptimizedBestValue(true) 528 .create(); 529 530 public static final String TEST_SUCCESS_DENSITY_KEY = "test_success_density"; 531 public static final Metric<Double> TEST_SUCCESS_DENSITY = new Metric.Builder(TEST_SUCCESS_DENSITY_KEY, "Unit Test Success (%)", Metric.ValueType.PERCENT) 532 .setDescription("Density of successful unit tests") 533 .setDirection(Metric.DIRECTION_BETTER) 534 .setQualitative(true) 535 .setDomain(DOMAIN_COVERAGE) 536 .setWorstValue(0.0) 537 .setBestValue(100.0) 538 .setOptimizedBestValue(true) 539 .create(); 540 541 /** 542 * @deprecated since 5.2 use {@link MutableTestPlan} 543 */ 544 @Deprecated 545 public static final String TEST_DATA_KEY = "test_data"; 546 /** 547 * @deprecated since 5.2 use {@link MutableTestPlan} 548 */ 549 @Deprecated 550 public static final Metric<String> TEST_DATA = new Metric.Builder(TEST_DATA_KEY, "Unit Test Details", Metric.ValueType.DATA) 551 .setDescription("Unit tests details") 552 .setDirection(Metric.DIRECTION_WORST) 553 .setDomain(DOMAIN_COVERAGE) 554 .create(); 555 556 public static final String COVERAGE_KEY = "coverage"; 557 public static final Metric<Double> COVERAGE = new Metric.Builder(COVERAGE_KEY, "Coverage", Metric.ValueType.PERCENT) 558 .setDescription("Coverage by tests") 559 .setDirection(Metric.DIRECTION_BETTER) 560 .setQualitative(true) 561 .setDomain(DOMAIN_COVERAGE) 562 .setWorstValue(0.0) 563 .setBestValue(100.0) 564 .create(); 565 566 public static final String NEW_COVERAGE_KEY = "new_coverage"; 567 public static final Metric<Double> NEW_COVERAGE = new Metric.Builder(NEW_COVERAGE_KEY, "Coverage on New Code", Metric.ValueType.PERCENT) 568 .setDescription("Coverage of new/changed code") 569 .setDirection(Metric.DIRECTION_BETTER) 570 .setQualitative(true) 571 .setDomain(DOMAIN_COVERAGE) 572 .setWorstValue(0.0) 573 .setBestValue(100.0) 574 .setDeleteHistoricalData(true) 575 .create(); 576 577 public static final String LINES_TO_COVER_KEY = "lines_to_cover"; 578 579 /** 580 * Use {@link CoverageMeasuresBuilder} to build measure for this metric. 581 */ 582 public static final Metric<Integer> LINES_TO_COVER = new Metric.Builder(LINES_TO_COVER_KEY, "Lines to Cover", Metric.ValueType.INT) 583 .setDescription("Lines to cover") 584 .setDirection(Metric.DIRECTION_BETTER) 585 .setQualitative(false) 586 .setDomain(DOMAIN_COVERAGE) 587 .create(); 588 589 public static final String NEW_LINES_TO_COVER_KEY = "new_lines_to_cover"; 590 public static final Metric<Integer> NEW_LINES_TO_COVER = new Metric.Builder(NEW_LINES_TO_COVER_KEY, "Lines to Cover on New Code", Metric.ValueType.INT) 591 .setDescription("Lines to cover on new code") 592 .setDirection(Metric.DIRECTION_WORST) 593 .setQualitative(false) 594 .setDomain(DOMAIN_COVERAGE) 595 .setDeleteHistoricalData(true) 596 .create(); 597 598 public static final String UNCOVERED_LINES_KEY = "uncovered_lines"; 599 600 /** 601 * Use {@link CoverageMeasuresBuilder} to build measure for this metric. 602 */ 603 public static final Metric<Integer> UNCOVERED_LINES = new Metric.Builder(UNCOVERED_LINES_KEY, "Uncovered Lines", Metric.ValueType.INT) 604 .setDescription("Uncovered lines") 605 .setDirection(Metric.DIRECTION_WORST) 606 .setDomain(DOMAIN_COVERAGE) 607 .setBestValue(0.0) 608 .create(); 609 610 public static final String NEW_UNCOVERED_LINES_KEY = "new_uncovered_lines"; 611 public static final Metric<Integer> NEW_UNCOVERED_LINES = new Metric.Builder(NEW_UNCOVERED_LINES_KEY, "Uncovered Lines on New Code", Metric.ValueType.INT) 612 .setDescription("Uncovered lines on new code") 613 .setDirection(Metric.DIRECTION_WORST) 614 .setDomain(DOMAIN_COVERAGE) 615 .setBestValue(0.0) 616 .setDeleteHistoricalData(true) 617 .create(); 618 619 public static final String LINE_COVERAGE_KEY = "line_coverage"; 620 public static final Metric<Double> LINE_COVERAGE = new Metric.Builder(LINE_COVERAGE_KEY, "Line Coverage", Metric.ValueType.PERCENT) 621 .setDescription("Line coverage") 622 .setDirection(Metric.DIRECTION_BETTER) 623 .setQualitative(true) 624 .setDomain(DOMAIN_COVERAGE) 625 .setWorstValue(0.0) 626 .setBestValue(100.0) 627 .create(); 628 629 public static final String NEW_LINE_COVERAGE_KEY = "new_line_coverage"; 630 public static final Metric<Double> NEW_LINE_COVERAGE = new Metric.Builder(NEW_LINE_COVERAGE_KEY, "Line Coverage on New Code", Metric.ValueType.PERCENT) 631 .setDescription("Line coverage of added/changed code") 632 .setDirection(Metric.DIRECTION_BETTER) 633 .setQualitative(true) 634 .setWorstValue(0.0) 635 .setBestValue(100.0) 636 .setDomain(DOMAIN_COVERAGE) 637 .setDeleteHistoricalData(true) 638 .create(); 639 640 /** 641 * 642 * @deprecated since 5.2 soon to be removed 643 */ 644 @Deprecated 645 public static final String COVERAGE_LINE_HITS_DATA_KEY = "coverage_line_hits_data"; 646 647 /** 648 * Key-value pairs, where key - is a number of line, and value - is a number of hits for this line. 649 * Use {@link CoverageMeasuresBuilder} to build measure for this metric. 650 * @deprecated since 5.2 soon to be removed 651 */ 652 @Deprecated 653 public static final Metric<String> COVERAGE_LINE_HITS_DATA = new Metric.Builder(COVERAGE_LINE_HITS_DATA_KEY, "Coverage Hits by Line", Metric.ValueType.DATA) 654 .setDescription("Coverage hits by line") 655 .setDomain(DOMAIN_COVERAGE) 656 .setDeleteHistoricalData(true) 657 .create(); 658 659 public static final String CONDITIONS_TO_COVER_KEY = "conditions_to_cover"; 660 661 /** 662 * Use {@link CoverageMeasuresBuilder} to build measure for this metric. 663 */ 664 public static final Metric<Integer> CONDITIONS_TO_COVER = new Metric.Builder(CONDITIONS_TO_COVER_KEY, "Branches to Cover", Metric.ValueType.INT) 665 .setDescription("Branches to cover") 666 .setDomain(DOMAIN_COVERAGE) 667 .setHidden(true) 668 .create(); 669 670 public static final String NEW_CONDITIONS_TO_COVER_KEY = "new_conditions_to_cover"; 671 public static final Metric<Integer> NEW_CONDITIONS_TO_COVER = new Metric.Builder(NEW_CONDITIONS_TO_COVER_KEY, "Branches to Cover on New Code", Metric.ValueType.INT) 672 .setDescription("Branches to cover on New Code") 673 .setDomain(DOMAIN_COVERAGE) 674 .setDeleteHistoricalData(true) 675 .setHidden(true) 676 .create(); 677 678 public static final String UNCOVERED_CONDITIONS_KEY = "uncovered_conditions"; 679 680 /** 681 * Use {@link CoverageMeasuresBuilder} to build measure for this metric. 682 */ 683 public static final Metric<Integer> UNCOVERED_CONDITIONS = new Metric.Builder(UNCOVERED_CONDITIONS_KEY, "Uncovered Conditions", Metric.ValueType.INT) 684 .setDescription("Uncovered conditions") 685 .setDirection(Metric.DIRECTION_WORST) 686 .setDomain(DOMAIN_COVERAGE) 687 .setBestValue(0.0) 688 .create(); 689 690 public static final String NEW_UNCOVERED_CONDITIONS_KEY = "new_uncovered_conditions"; 691 public static final Metric<Integer> NEW_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_UNCOVERED_CONDITIONS_KEY, "Uncovered Conditions on New Code", Metric.ValueType.INT) 692 .setDescription("Uncovered conditions on new code") 693 .setDirection(Metric.DIRECTION_WORST) 694 .setDomain(DOMAIN_COVERAGE) 695 .setBestValue(0.0) 696 .setDeleteHistoricalData(true) 697 .create(); 698 699 public static final String BRANCH_COVERAGE_KEY = "branch_coverage"; 700 public static final Metric<Double> BRANCH_COVERAGE = new Metric.Builder(BRANCH_COVERAGE_KEY, "Condition Coverage", Metric.ValueType.PERCENT) 701 .setDescription("Condition coverage") 702 .setDirection(Metric.DIRECTION_BETTER) 703 .setQualitative(true) 704 .setDomain(DOMAIN_COVERAGE) 705 .setWorstValue(0.0) 706 .setBestValue(100.0) 707 .create(); 708 709 public static final String NEW_BRANCH_COVERAGE_KEY = "new_branch_coverage"; 710 public static final Metric<Double> NEW_BRANCH_COVERAGE = new Metric.Builder(NEW_BRANCH_COVERAGE_KEY, "Condition Coverage on New Code", Metric.ValueType.PERCENT) 711 .setDescription("Condition coverage of new/changed code") 712 .setDirection(Metric.DIRECTION_BETTER) 713 .setQualitative(true) 714 .setDomain(DOMAIN_COVERAGE) 715 .setWorstValue(0.0) 716 .setBestValue(100.0) 717 .setDeleteHistoricalData(true) 718 .create(); 719 720 /** 721 * @deprecated since 5.2 soon to be removed 722 */ 723 @Deprecated 724 public static final String CONDITIONS_BY_LINE_KEY = "conditions_by_line"; 725 726 /** 727 * Use {@link CoverageMeasuresBuilder} to build measure for this metric. 728 * 729 * @since 2.7 730 * @deprecated since 5.2 soon to be removed 731 */ 732 @Deprecated 733 public static final Metric<String> CONDITIONS_BY_LINE = new Metric.Builder(CONDITIONS_BY_LINE_KEY, "Conditions by Line", Metric.ValueType.DATA) 734 .setDescription("Conditions by line") 735 .setDomain(DOMAIN_COVERAGE) 736 .setDeleteHistoricalData(true) 737 .create(); 738 739 /** 740 * @deprecated since 5.2 soon to be removed 741 */ 742 @Deprecated 743 public static final String COVERED_CONDITIONS_BY_LINE_KEY = "covered_conditions_by_line"; 744 745 /** 746 * Use {@link CoverageMeasuresBuilder} to build measure for this metric. 747 * 748 * @since 2.7 749 * @deprecated since 5.2 soon to be removed 750 */ 751 @Deprecated 752 public static final Metric<String> COVERED_CONDITIONS_BY_LINE = new Metric.Builder(COVERED_CONDITIONS_BY_LINE_KEY, "Covered Conditions by Line", Metric.ValueType.DATA) 753 .setDescription("Covered conditions by line") 754 .setDomain(DOMAIN_COVERAGE) 755 .setDeleteHistoricalData(true) 756 .create(); 757 758 // -------------------------------------------------------------------------------------------------------------------- 759 // 760 // INTEGRATION TESTS 761 // 762 // -------------------------------------------------------------------------------------------------------------------- 763 764 /** 765 * @since 2.12 766 * @deprecated since 6.2 all coverage reports are merged in the same measures 767 */ 768 @Deprecated 769 public static final String IT_COVERAGE_KEY = "it_coverage"; 770 771 /** 772 * @since 2.12 773 * @deprecated since 6.2 all coverage reports are merged in the same measures 774 */ 775 @Deprecated 776 public static final Metric<Double> IT_COVERAGE = new Metric.Builder(IT_COVERAGE_KEY, "IT Coverage", Metric.ValueType.PERCENT) 777 .setDescription("Integration tests coverage") 778 .setDirection(Metric.DIRECTION_BETTER) 779 .setQualitative(true) 780 .setDomain(DOMAIN_COVERAGE) 781 .setWorstValue(0.0) 782 .setBestValue(100.0) 783 .setHidden(true) 784 .create(); 785 786 /** 787 * @since 2.12 788 * @deprecated since 6.2 all coverage reports are merged in the same measures 789 */ 790 @Deprecated 791 public static final String NEW_IT_COVERAGE_KEY = "new_it_coverage"; 792 793 /** 794 * @since 2.12 795 * @deprecated since 6.2 all coverage reports are merged in the same measures 796 */ 797 @Deprecated 798 public static final Metric<Double> NEW_IT_COVERAGE = new Metric.Builder(NEW_IT_COVERAGE_KEY, "Coverage by IT on New Code", Metric.ValueType.PERCENT) 799 .setDescription("Integration tests coverage of new/changed code") 800 .setDirection(Metric.DIRECTION_BETTER) 801 .setQualitative(true) 802 .setDomain(DOMAIN_COVERAGE) 803 .setWorstValue(0.0) 804 .setBestValue(100.0) 805 .setDeleteHistoricalData(true) 806 .setHidden(true) 807 .create(); 808 809 /** 810 * @since 2.12 811 * @deprecated since 6.2 all coverage reports are merged in the same measures 812 */ 813 @Deprecated 814 public static final String IT_LINES_TO_COVER_KEY = "it_lines_to_cover"; 815 816 /** 817 * @since 2.12 818 * @deprecated since 6.2 all coverage reports are merged in the same measures 819 */ 820 @Deprecated 821 public static final Metric<Integer> IT_LINES_TO_COVER = new Metric.Builder(IT_LINES_TO_COVER_KEY, "IT Lines to Cover", Metric.ValueType.INT) 822 .setDescription("Lines to cover by Integration Tests") 823 .setDirection(Metric.DIRECTION_BETTER) 824 .setDomain(DOMAIN_COVERAGE) 825 .setQualitative(false) 826 .setHidden(true) 827 .create(); 828 829 /** 830 * @since 2.12 831 * @deprecated since 6.2 all coverage reports are merged in the same measures 832 */ 833 @Deprecated 834 public static final String NEW_IT_LINES_TO_COVER_KEY = "new_it_lines_to_cover"; 835 836 /** 837 * @since 2.12 838 * @deprecated since 6.2 all coverage reports are merged in the same measures 839 */ 840 @Deprecated 841 public static final Metric<Integer> 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) 842 .setDescription("Lines to cover on new code by integration tests") 843 .setDirection(Metric.DIRECTION_WORST) 844 .setQualitative(false) 845 .setDomain(DOMAIN_COVERAGE) 846 .setDeleteHistoricalData(true) 847 .setHidden(true) 848 .create(); 849 850 /** 851 * @since 2.12 852 * @deprecated since 6.2 all coverage reports are merged in the same measures 853 */ 854 @Deprecated 855 public static final String IT_UNCOVERED_LINES_KEY = "it_uncovered_lines"; 856 857 /** 858 * @since 2.12 859 * @deprecated since 6.2 all coverage reports are merged in the same measures 860 */ 861 @Deprecated 862 public static final Metric<Integer> IT_UNCOVERED_LINES = new Metric.Builder(IT_UNCOVERED_LINES_KEY, "IT Uncovered Lines", Metric.ValueType.INT) 863 .setDescription("Uncovered lines by integration tests") 864 .setDirection(Metric.DIRECTION_WORST) 865 .setQualitative(false) 866 .setDomain(DOMAIN_COVERAGE) 867 .setHidden(true) 868 .create(); 869 870 /** 871 * @since 2.12 872 * @deprecated since 6.2 all coverage reports are merged in the same measures 873 */ 874 @Deprecated 875 public static final String NEW_IT_UNCOVERED_LINES_KEY = "new_it_uncovered_lines"; 876 877 /** 878 * @since 2.12 879 * @deprecated since 6.2 all coverage reports are merged in the same measures 880 */ 881 @Deprecated 882 public static final Metric<Integer> NEW_IT_UNCOVERED_LINES = new Metric.Builder(NEW_IT_UNCOVERED_LINES_KEY, "Uncovered Lines by IT on New Code", Metric.ValueType.INT) 883 .setDescription("New lines that are not covered by integration tests") 884 .setDirection(Metric.DIRECTION_WORST) 885 .setDomain(DOMAIN_COVERAGE) 886 .setBestValue(0.0) 887 .setDeleteHistoricalData(true) 888 .setHidden(true) 889 .create(); 890 891 /** 892 * @since 2.12 893 * @deprecated since 6.2 all coverage reports are merged in the same measures 894 */ 895 @Deprecated 896 public static final String IT_LINE_COVERAGE_KEY = "it_line_coverage"; 897 898 /** 899 * @since 2.12 900 * @deprecated since 6.2 all coverage reports are merged in the same measures 901 */ 902 @Deprecated 903 public static final Metric<Double> IT_LINE_COVERAGE = new Metric.Builder(IT_LINE_COVERAGE_KEY, "IT Line Coverage", Metric.ValueType.PERCENT) 904 .setDescription("Line coverage by integration tests") 905 .setDirection(Metric.DIRECTION_BETTER) 906 .setQualitative(true) 907 .setDomain(DOMAIN_COVERAGE) 908 .setHidden(true) 909 .create(); 910 911 /** 912 * @since 2.12 913 * @deprecated since 6.2 all coverage reports are merged in the same measures 914 */ 915 @Deprecated 916 public static final String NEW_IT_LINE_COVERAGE_KEY = "new_it_line_coverage"; 917 918 /** 919 * @since 2.12 920 * @deprecated since 6.2 all coverage reports are merged in the same measures 921 */ 922 @Deprecated 923 public static final Metric<Double> NEW_IT_LINE_COVERAGE = new Metric.Builder(NEW_IT_LINE_COVERAGE_KEY, "Line Coverage by IT on New Code", Metric.ValueType.PERCENT) 924 .setDescription("Integration tests line coverage of added/changed code") 925 .setDirection(Metric.DIRECTION_BETTER) 926 .setQualitative(true) 927 .setWorstValue(0.0) 928 .setBestValue(100.0) 929 .setDomain(DOMAIN_COVERAGE) 930 .setDeleteHistoricalData(true) 931 .setHidden(true) 932 .create(); 933 934 /** 935 * @since 2.12 936 * @deprecated since 5.2 soon to be removed 937 */ 938 @Deprecated 939 public static final String IT_COVERAGE_LINE_HITS_DATA_KEY = "it_coverage_line_hits_data"; 940 941 /** 942 * @since 2.12 943 * @deprecated since 5.2 soon to be removed 944 */ 945 @Deprecated 946 public static final Metric<String> IT_COVERAGE_LINE_HITS_DATA = new Metric.Builder(IT_COVERAGE_LINE_HITS_DATA_KEY, "IT Coverage Hits by Line", Metric.ValueType.DATA) 947 .setDescription("Coverage hits by line by integration tests") 948 .setDirection(Metric.DIRECTION_NONE) 949 .setQualitative(false) 950 .setDomain(DOMAIN_COVERAGE) 951 .setDeleteHistoricalData(true) 952 .setHidden(true) 953 .create(); 954 955 /** 956 * @since 2.12 957 * @deprecated since 6.2 all coverage reports are merged in the same measures 958 */ 959 @Deprecated 960 public static final String IT_CONDITIONS_TO_COVER_KEY = "it_conditions_to_cover"; 961 962 /** 963 * @since 2.12 964 * @deprecated since 6.2 all coverage reports are merged in the same measures 965 */ 966 @Deprecated 967 public static final Metric<Integer> IT_CONDITIONS_TO_COVER = new Metric.Builder(IT_CONDITIONS_TO_COVER_KEY, "IT Branches to Cover", Metric.ValueType.INT) 968 .setDescription("Integration Tests conditions to cover") 969 .setDirection(Metric.DIRECTION_BETTER) 970 .setQualitative(false) 971 .setDomain(DOMAIN_COVERAGE) 972 .setHidden(true) 973 .create(); 974 975 /** 976 * @since 2.12 977 * @deprecated since 6.2 all coverage reports are merged in the same measures 978 */ 979 @Deprecated 980 public static final String NEW_IT_CONDITIONS_TO_COVER_KEY = "new_it_conditions_to_cover"; 981 982 /** 983 * @since 2.12 984 * @deprecated since 6.2 all coverage reports are merged in the same measures 985 */ 986 @Deprecated 987 public static final Metric<Integer> 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) 988 .setDescription("Branches to cover by Integration Tests on New Code") 989 .setDomain(DOMAIN_COVERAGE) 990 .setDeleteHistoricalData(true) 991 .setHidden(true) 992 .create(); 993 994 /** 995 * @since 2.12 996 * @deprecated since 6.2 all coverage reports are merged in the same measures 997 */ 998 @Deprecated 999 public static final String IT_UNCOVERED_CONDITIONS_KEY = "it_uncovered_conditions"; 1000 1001 /** 1002 * @since 2.12 1003 * @deprecated since 6.2 all coverage reports are merged in the same measures 1004 */ 1005 @Deprecated 1006 public static final Metric<Integer> IT_UNCOVERED_CONDITIONS = new Metric.Builder(IT_UNCOVERED_CONDITIONS_KEY, "IT Uncovered Conditions", Metric.ValueType.INT) 1007 .setDescription("Uncovered conditions by integration tests") 1008 .setDirection(Metric.DIRECTION_WORST) 1009 .setDomain(DOMAIN_COVERAGE) 1010 .setHidden(true) 1011 .create(); 1012 1013 /** 1014 * @since 2.12 1015 * @deprecated since 6.2 all coverage reports are merged in the same measures 1016 */ 1017 @Deprecated 1018 public static final String NEW_IT_UNCOVERED_CONDITIONS_KEY = "new_it_uncovered_conditions"; 1019 1020 /** 1021 * @since 2.12 1022 * @deprecated since 6.2 all coverage reports are merged in the same measures 1023 */ 1024 @Deprecated 1025 public static final Metric<Integer> NEW_IT_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_IT_UNCOVERED_CONDITIONS_KEY, "Uncovered Conditions by IT on New Code", 1026 Metric.ValueType.INT) 1027 .setDescription("New conditions that are not covered by integration tests") 1028 .setDirection(Metric.DIRECTION_WORST) 1029 .setDomain(DOMAIN_COVERAGE) 1030 .setBestValue(0.0) 1031 .setDeleteHistoricalData(true) 1032 .setHidden(true) 1033 .create(); 1034 1035 /** 1036 * @since 2.12 1037 * @deprecated since 6.2 all coverage reports are merged in the same measures 1038 */ 1039 @Deprecated 1040 public static final String IT_BRANCH_COVERAGE_KEY = "it_branch_coverage"; 1041 1042 /** 1043 * @since 2.12 1044 * @deprecated since 6.2 all coverage reports are merged in the same measures 1045 */ 1046 @Deprecated 1047 public static final Metric<Double> IT_BRANCH_COVERAGE = new Metric.Builder(IT_BRANCH_COVERAGE_KEY, "IT Condition Coverage", Metric.ValueType.PERCENT) 1048 .setDescription("Condition coverage by integration tests") 1049 .setDirection(Metric.DIRECTION_BETTER) 1050 .setQualitative(true) 1051 .setDomain(DOMAIN_COVERAGE) 1052 .setWorstValue(0.0) 1053 .setBestValue(100.0) 1054 .setHidden(true) 1055 .create(); 1056 1057 /** 1058 * @since 2.12 1059 * @deprecated since 6.2 all coverage reports are merged in the same measures 1060 */ 1061 @Deprecated 1062 public static final String NEW_IT_BRANCH_COVERAGE_KEY = "new_it_branch_coverage"; 1063 1064 /** 1065 * @since 2.12 1066 * @deprecated since 6.2 all coverage reports are merged in the same measures 1067 */ 1068 @Deprecated 1069 public static final Metric<Double> NEW_IT_BRANCH_COVERAGE = new Metric.Builder(NEW_IT_BRANCH_COVERAGE_KEY, "Condition Coverage by IT on New Code", Metric.ValueType.PERCENT) 1070 .setDescription("Integration tests condition coverage of new/changed code") 1071 .setDirection(Metric.DIRECTION_BETTER) 1072 .setQualitative(true) 1073 .setDomain(DOMAIN_COVERAGE) 1074 .setWorstValue(0.0) 1075 .setBestValue(100.0) 1076 .setDeleteHistoricalData(true) 1077 .setHidden(true) 1078 .create(); 1079 1080 /** 1081 * @since 2.12 1082 * @deprecated since 5.2 soon to be removed 1083 */ 1084 @Deprecated 1085 public static final String IT_CONDITIONS_BY_LINE_KEY = "it_conditions_by_line"; 1086 1087 /** 1088 * @since 2.12 1089 * @deprecated since 5.2 soon to be removed 1090 */ 1091 @Deprecated 1092 public static final Metric<String> IT_CONDITIONS_BY_LINE = new Metric.Builder(IT_CONDITIONS_BY_LINE_KEY, "IT Conditions by Line", Metric.ValueType.DATA) 1093 .setDescription("IT conditions by line") 1094 .setDomain(DOMAIN_COVERAGE) 1095 .setDeleteHistoricalData(true) 1096 .create(); 1097 1098 /** 1099 * @since 2.12 1100 * @deprecated since 5.2 soon to be removed 1101 */ 1102 @Deprecated 1103 public static final String IT_COVERED_CONDITIONS_BY_LINE_KEY = "it_covered_conditions_by_line"; 1104 1105 /** 1106 * @since 2.12 1107 * @deprecated since 5.2 soon to be removed 1108 */ 1109 @Deprecated 1110 public static final Metric<String> IT_COVERED_CONDITIONS_BY_LINE = new Metric.Builder(IT_COVERED_CONDITIONS_BY_LINE_KEY, "IT Covered Conditions by Line", Metric.ValueType.DATA) 1111 .setDescription("IT covered conditions by line") 1112 .setDomain(DOMAIN_COVERAGE) 1113 .setDeleteHistoricalData(true) 1114 .create(); 1115 1116 // -------------------------------------------------------------------------------------------------------------------- 1117 // 1118 // OVERALL TESTS 1119 // 1120 // -------------------------------------------------------------------------------------------------------------------- 1121 1122 /** 1123 * @since 3.3 1124 * @deprecated since 6.2 all coverage reports are merged in the same measures 1125 */ 1126 @Deprecated 1127 public static final String OVERALL_COVERAGE_KEY = "overall_coverage"; 1128 1129 /** 1130 * @since 3.3 1131 * @deprecated since 6.2 all coverage reports are merged in the same measures 1132 */ 1133 @Deprecated 1134 public static final Metric<Double> OVERALL_COVERAGE = new Metric.Builder(OVERALL_COVERAGE_KEY, "Overall Coverage", Metric.ValueType.PERCENT) 1135 .setDescription("Overall test coverage") 1136 .setDirection(Metric.DIRECTION_BETTER) 1137 .setQualitative(true) 1138 .setDomain(DOMAIN_COVERAGE) 1139 .setWorstValue(0.0) 1140 .setBestValue(100.0) 1141 .setHidden(true) 1142 .create(); 1143 1144 /** 1145 * @since 3.3 1146 * @deprecated since 6.2 all coverage reports are merged in the same measures 1147 */ 1148 @Deprecated 1149 public static final String NEW_OVERALL_COVERAGE_KEY = "new_overall_coverage"; 1150 1151 /** 1152 * @since 3.3 1153 * @deprecated since 6.2 all coverage reports are merged in the same measures 1154 */ 1155 @Deprecated 1156 public static final Metric<Double> NEW_OVERALL_COVERAGE = new Metric.Builder(NEW_OVERALL_COVERAGE_KEY, "Overall Coverage on New Code", Metric.ValueType.PERCENT) 1157 .setDescription("Overall coverage of new/changed code") 1158 .setDirection(Metric.DIRECTION_BETTER) 1159 .setQualitative(true) 1160 .setDomain(DOMAIN_COVERAGE) 1161 .setWorstValue(0.0) 1162 .setBestValue(100.0) 1163 .setDeleteHistoricalData(true) 1164 .setHidden(true) 1165 .create(); 1166 1167 /** 1168 * @since 3.3 1169 * @deprecated since 6.2 all coverage reports are merged in the same measures 1170 */ 1171 @Deprecated 1172 public static final String OVERALL_LINES_TO_COVER_KEY = "overall_lines_to_cover"; 1173 1174 /** 1175 * @since 3.3 1176 * @deprecated since 6.2 all coverage reports are merged in the same measures 1177 */ 1178 @Deprecated 1179 public static final Metric<Integer> OVERALL_LINES_TO_COVER = new Metric.Builder(OVERALL_LINES_TO_COVER_KEY, "Overall Lines to Cover", Metric.ValueType.INT) 1180 .setDescription("Overall lines to cover by all tests") 1181 .setDirection(Metric.DIRECTION_BETTER) 1182 .setDomain(DOMAIN_COVERAGE) 1183 .setQualitative(false) 1184 .setHidden(true) 1185 .create(); 1186 1187 /** 1188 * @since 3.3 1189 * @deprecated since 6.2 all coverage reports are merged in the same measures 1190 */ 1191 @Deprecated 1192 public static final String NEW_OVERALL_LINES_TO_COVER_KEY = "new_overall_lines_to_cover"; 1193 1194 /** 1195 * @since 3.3 1196 * @deprecated since 6.2 all coverage reports are merged in the same measures 1197 */ 1198 @Deprecated 1199 public static final Metric<Integer> NEW_OVERALL_LINES_TO_COVER = new Metric.Builder(NEW_OVERALL_LINES_TO_COVER_KEY, "Overall Lines to Cover on New Code", Metric.ValueType.INT) 1200 .setDescription("New lines to cover by all tests") 1201 .setDirection(Metric.DIRECTION_WORST) 1202 .setQualitative(false) 1203 .setDomain(DOMAIN_COVERAGE) 1204 .setDeleteHistoricalData(true) 1205 .setHidden(true) 1206 .create(); 1207 1208 /** 1209 * @since 3.3 1210 * @deprecated since 6.2 all coverage reports are merged in the same measures 1211 */ 1212 @Deprecated 1213 public static final String OVERALL_UNCOVERED_LINES_KEY = "overall_uncovered_lines"; 1214 1215 /** 1216 * @since 3.3 1217 * @deprecated since 6.2 all coverage reports are merged in the same measures 1218 */ 1219 @Deprecated 1220 public static final Metric<Integer> OVERALL_UNCOVERED_LINES = new Metric.Builder(OVERALL_UNCOVERED_LINES_KEY, "Overall Uncovered Lines", Metric.ValueType.INT) 1221 .setDescription("Uncovered lines by all tests") 1222 .setDirection(Metric.DIRECTION_WORST) 1223 .setQualitative(false) 1224 .setDomain(DOMAIN_COVERAGE) 1225 .setHidden(true) 1226 .create(); 1227 1228 /** 1229 * @since 3.3 1230 * @deprecated since 6.2 all coverage reports are merged in the same measures 1231 */ 1232 @Deprecated 1233 public static final String NEW_OVERALL_UNCOVERED_LINES_KEY = "new_overall_uncovered_lines"; 1234 1235 /** 1236 * @since 3.3 1237 * @deprecated since 6.2 all coverage reports are merged in the same measures 1238 */ 1239 @Deprecated 1240 public static final Metric<Integer> NEW_OVERALL_UNCOVERED_LINES = new Metric.Builder(NEW_OVERALL_UNCOVERED_LINES_KEY, "Overall Uncovered Lines on New Code", Metric.ValueType.INT) 1241 .setDescription("New lines that are not covered by any tests") 1242 .setDirection(Metric.DIRECTION_WORST) 1243 .setDomain(DOMAIN_COVERAGE) 1244 .setBestValue(0.0) 1245 .setDeleteHistoricalData(true) 1246 .setHidden(true) 1247 .create(); 1248 1249 /** 1250 * @since 3.3 1251 * @deprecated since 6.2 all coverage reports are merged in the same measures 1252 */ 1253 @Deprecated 1254 public static final String OVERALL_LINE_COVERAGE_KEY = "overall_line_coverage"; 1255 1256 /** 1257 * @since 3.3 1258 * @deprecated since 6.2 all coverage reports are merged in the same measures 1259 */ 1260 @Deprecated 1261 public static final Metric<Double> OVERALL_LINE_COVERAGE = new Metric.Builder(OVERALL_LINE_COVERAGE_KEY, "Overall Line Coverage", Metric.ValueType.PERCENT) 1262 .setDescription("Line coverage by all tests") 1263 .setDirection(Metric.DIRECTION_BETTER) 1264 .setQualitative(true) 1265 .setDomain(DOMAIN_COVERAGE) 1266 .setHidden(true) 1267 .create(); 1268 1269 /** 1270 * @since 3.3 1271 * @deprecated since 6.2 all coverage reports are merged in the same measures 1272 */ 1273 @Deprecated 1274 public static final String NEW_OVERALL_LINE_COVERAGE_KEY = "new_overall_line_coverage"; 1275 1276 /** 1277 * @since 3.3 1278 * @deprecated since 6.2 all coverage reports are merged in the same measures 1279 */ 1280 @Deprecated 1281 public static final Metric<Double> NEW_OVERALL_LINE_COVERAGE = new Metric.Builder(NEW_OVERALL_LINE_COVERAGE_KEY, "Overall Line Coverage on New Code", Metric.ValueType.PERCENT) 1282 .setDescription("Line coverage of added/changed code by all tests") 1283 .setDirection(Metric.DIRECTION_BETTER) 1284 .setQualitative(true) 1285 .setWorstValue(0.0) 1286 .setBestValue(100.0) 1287 .setDomain(DOMAIN_COVERAGE) 1288 .setDeleteHistoricalData(true) 1289 .setHidden(true) 1290 .create(); 1291 1292 /** 1293 * @since 3.3 1294 * @deprecated since 5.2 soon to be removed 1295 */ 1296 @Deprecated 1297 public static final String OVERALL_COVERAGE_LINE_HITS_DATA_KEY = "overall_coverage_line_hits_data"; 1298 1299 /** 1300 * @since 3.3 1301 * @deprecated since 5.2 soon to be removed 1302 */ 1303 @Deprecated 1304 public static final Metric<String> OVERALL_COVERAGE_LINE_HITS_DATA = new Metric.Builder(OVERALL_COVERAGE_LINE_HITS_DATA_KEY, "Overall Coverage Hits by Line", 1305 Metric.ValueType.DATA) 1306 .setDescription("Coverage hits by all tests and by line") 1307 .setDirection(Metric.DIRECTION_NONE) 1308 .setQualitative(false) 1309 .setDomain(DOMAIN_COVERAGE) 1310 .setDeleteHistoricalData(true) 1311 .create(); 1312 1313 /** 1314 * @since 3.3 1315 * @deprecated since 6.2 all coverage reports are merged in the same measures 1316 */ 1317 @Deprecated 1318 public static final String OVERALL_CONDITIONS_TO_COVER_KEY = "overall_conditions_to_cover"; 1319 1320 /** 1321 * @since 3.3 1322 * @deprecated since 6.2 all coverage reports are merged in the same measures 1323 */ 1324 @Deprecated 1325 public static final Metric<Integer> OVERALL_CONDITIONS_TO_COVER = new Metric.Builder(OVERALL_CONDITIONS_TO_COVER_KEY, "Overall Branches to Cover", Metric.ValueType.INT) 1326 .setDescription("Branches to cover by all tests") 1327 .setDirection(Metric.DIRECTION_BETTER) 1328 .setQualitative(false) 1329 .setDomain(DOMAIN_COVERAGE) 1330 .setHidden(true) 1331 .create(); 1332 1333 /** 1334 * @since 3.3 1335 * @deprecated since 6.2 all coverage reports are merged in the same measures 1336 */ 1337 @Deprecated 1338 public static final String NEW_OVERALL_CONDITIONS_TO_COVER_KEY = "new_overall_conditions_to_cover"; 1339 1340 /** 1341 * @since 3.3 1342 * @deprecated since 6.2 all coverage reports are merged in the same measures 1343 */ 1344 @Deprecated 1345 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", 1346 Metric.ValueType.INT) 1347 .setDescription("New branches to cover by all tests") 1348 .setDomain(DOMAIN_COVERAGE) 1349 .setDeleteHistoricalData(true) 1350 .setHidden(true) 1351 .create(); 1352 1353 /** 1354 * @since 3.3 1355 * @deprecated since 6.2 all coverage reports are merged in the same measures 1356 */ 1357 @Deprecated 1358 public static final String OVERALL_UNCOVERED_CONDITIONS_KEY = "overall_uncovered_conditions"; 1359 1360 /** 1361 * @since 3.3 1362 * @deprecated since 6.2 all coverage reports are merged in the same measures 1363 */ 1364 @Deprecated 1365 public static final Metric<Integer> OVERALL_UNCOVERED_CONDITIONS = new Metric.Builder(OVERALL_UNCOVERED_CONDITIONS_KEY, "Overall Uncovered Conditions", Metric.ValueType.INT) 1366 .setDescription("Uncovered conditions by all tests") 1367 .setDirection(Metric.DIRECTION_WORST) 1368 .setDomain(DOMAIN_COVERAGE) 1369 .setHidden(true) 1370 .create(); 1371 1372 /** 1373 * @since 3.3 1374 * @deprecated since 6.2 all coverage reports are merged in the same measures 1375 */ 1376 @Deprecated 1377 public static final String NEW_OVERALL_UNCOVERED_CONDITIONS_KEY = "new_overall_uncovered_conditions"; 1378 1379 /** 1380 * @since 3.3 1381 * @deprecated since 6.2 all coverage reports are merged in the same measures 1382 */ 1383 @Deprecated 1384 public static final Metric<Integer> NEW_OVERALL_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_OVERALL_UNCOVERED_CONDITIONS_KEY, "Overall Uncovered Conditions on New Code", 1385 Metric.ValueType.INT) 1386 .setDescription("New conditions that are not covered by any test") 1387 .setDirection(Metric.DIRECTION_WORST) 1388 .setDomain(DOMAIN_COVERAGE) 1389 .setBestValue(0.0) 1390 .setDeleteHistoricalData(true) 1391 .setHidden(true) 1392 .create(); 1393 1394 /** 1395 * @since 3.3 1396 * @deprecated since 6.2 all coverage reports are merged in the same measures 1397 */ 1398 @Deprecated 1399 public static final String OVERALL_BRANCH_COVERAGE_KEY = "overall_branch_coverage"; 1400 1401 /** 1402 * @since 3.3 1403 * @deprecated since 6.2 all coverage reports are merged in the same measures 1404 */ 1405 @Deprecated 1406 public static final Metric<Double> OVERALL_BRANCH_COVERAGE = new Metric.Builder(OVERALL_BRANCH_COVERAGE_KEY, "Overall Condition Coverage", Metric.ValueType.PERCENT) 1407 .setDescription("Condition coverage by all tests") 1408 .setDirection(Metric.DIRECTION_BETTER) 1409 .setQualitative(true) 1410 .setDomain(DOMAIN_COVERAGE) 1411 .setWorstValue(0.0) 1412 .setBestValue(100.0) 1413 .setHidden(true) 1414 .create(); 1415 1416 /** 1417 * @since 3.3 1418 * @deprecated since 6.2 all coverage reports are merged in the same measures 1419 */ 1420 @Deprecated 1421 public static final String NEW_OVERALL_BRANCH_COVERAGE_KEY = "new_overall_branch_coverage"; 1422 1423 /** 1424 * @since 3.3 1425 * @deprecated since 6.2 all coverage reports are merged in the same measures 1426 */ 1427 @Deprecated 1428 public static final Metric<Double> NEW_OVERALL_BRANCH_COVERAGE = new Metric.Builder(NEW_OVERALL_BRANCH_COVERAGE_KEY, "Overall Condition Coverage on New Code", 1429 Metric.ValueType.PERCENT) 1430 .setDescription("Condition coverage of new/changed code by all tests") 1431 .setDirection(Metric.DIRECTION_BETTER) 1432 .setQualitative(true) 1433 .setDomain(DOMAIN_COVERAGE) 1434 .setWorstValue(0.0) 1435 .setBestValue(100.0) 1436 .setDeleteHistoricalData(true) 1437 .setHidden(true) 1438 .create(); 1439 1440 /** 1441 * @since 3.3 1442 * @deprecated since 5.2 soon to be removed 1443 */ 1444 @Deprecated 1445 public static final String OVERALL_CONDITIONS_BY_LINE_KEY = "overall_conditions_by_line"; 1446 1447 /** 1448 * @since 3.3 1449 * @deprecated since 5.2 soon to be removed 1450 */ 1451 @Deprecated 1452 public static final Metric<String> OVERALL_CONDITIONS_BY_LINE = new Metric.Builder(OVERALL_CONDITIONS_BY_LINE_KEY, "Overall Conditions by Line", Metric.ValueType.DATA) 1453 .setDescription("Overall conditions by all tests and by line") 1454 .setDomain(DOMAIN_COVERAGE) 1455 .setDeleteHistoricalData(true) 1456 .create(); 1457 1458 /** 1459 * @since 3.3 1460 * @deprecated since 5.2 soon to be removed 1461 */ 1462 @Deprecated 1463 public static final String OVERALL_COVERED_CONDITIONS_BY_LINE_KEY = "overall_covered_conditions_by_line"; 1464 1465 /** 1466 * @since 3.3 1467 * @deprecated since 5.2 soon to be removed 1468 */ 1469 @Deprecated 1470 public static final Metric<String> OVERALL_COVERED_CONDITIONS_BY_LINE = new Metric.Builder(OVERALL_COVERED_CONDITIONS_BY_LINE_KEY, "Overall Covered Conditions by Line", 1471 Metric.ValueType.DATA) 1472 .setDescription("Overall covered conditions by all tests and by line") 1473 .setDomain(DOMAIN_COVERAGE) 1474 .setDeleteHistoricalData(true) 1475 .create(); 1476 1477 // -------------------------------------------------------------------------------------------------------------------- 1478 // 1479 // DUPLICATIONS 1480 // 1481 // -------------------------------------------------------------------------------------------------------------------- 1482 1483 public static final String DUPLICATED_LINES_KEY = "duplicated_lines"; 1484 public static final Metric<Integer> DUPLICATED_LINES = new Metric.Builder(DUPLICATED_LINES_KEY, "Duplicated Lines", Metric.ValueType.INT) 1485 .setDescription("Duplicated lines") 1486 .setDirection(Metric.DIRECTION_WORST) 1487 .setQualitative(true) 1488 .setDomain(DOMAIN_DUPLICATIONS) 1489 .setBestValue(0.0) 1490 .setOptimizedBestValue(true) 1491 .create(); 1492 1493 /** 1494 * @since 6.1 1495 */ 1496 public static final String NEW_DUPLICATED_LINES_KEY = "new_duplicated_lines"; 1497 1498 /** 1499 * @since 6.1 1500 */ 1501 public static final Metric<Integer> NEW_DUPLICATED_LINES = new Metric.Builder(NEW_DUPLICATED_LINES_KEY, "Duplicated Lines on New Code", Metric.ValueType.INT) 1502 .setDescription("Duplicated Lines on New Code") 1503 .setDirection(Metric.DIRECTION_WORST) 1504 .setQualitative(true) 1505 .setDomain(DOMAIN_DUPLICATIONS) 1506 .setBestValue(0.0) 1507 .setDeleteHistoricalData(true) 1508 .create(); 1509 1510 public static final String DUPLICATED_BLOCKS_KEY = "duplicated_blocks"; 1511 public static final Metric<Integer> DUPLICATED_BLOCKS = new Metric.Builder(DUPLICATED_BLOCKS_KEY, "Duplicated Blocks", Metric.ValueType.INT) 1512 .setDescription("Duplicated blocks") 1513 .setDirection(Metric.DIRECTION_WORST) 1514 .setQualitative(true) 1515 .setDomain(DOMAIN_DUPLICATIONS) 1516 .setBestValue(0.0) 1517 .setOptimizedBestValue(true) 1518 .create(); 1519 1520 /** 1521 * @since 6.1 1522 */ 1523 public static final String NEW_BLOCKS_DUPLICATED_KEY = "new_duplicated_blocks"; 1524 /** 1525 * @since 6.1 1526 */ 1527 public static final Metric<Integer> NEW_BLOCKS_DUPLICATED = new Metric.Builder(NEW_BLOCKS_DUPLICATED_KEY, "Duplicated Blocks on New Code", Metric.ValueType.INT) 1528 .setDescription("Duplicated blocks on new code") 1529 .setDirection(Metric.DIRECTION_WORST) 1530 .setQualitative(true) 1531 .setDomain(DOMAIN_DUPLICATIONS) 1532 .setBestValue(0.0) 1533 .setDeleteHistoricalData(true) 1534 .create(); 1535 1536 public static final String DUPLICATED_FILES_KEY = "duplicated_files"; 1537 1538 /** 1539 * For files: if it contains duplicates, then 1, otherwise 0. 1540 * For other resources: amount of files under this resource with duplicates. 1541 */ 1542 public static final Metric<Integer> DUPLICATED_FILES = new Metric.Builder(DUPLICATED_FILES_KEY, "Duplicated Files", Metric.ValueType.INT) 1543 .setDescription("Duplicated files") 1544 .setDirection(Metric.DIRECTION_WORST) 1545 .setQualitative(true) 1546 .setDomain(DOMAIN_DUPLICATIONS) 1547 .setBestValue(0.0) 1548 .setOptimizedBestValue(true) 1549 .create(); 1550 1551 public static final String DUPLICATED_LINES_DENSITY_KEY = "duplicated_lines_density"; 1552 1553 public static final Metric<Double> DUPLICATED_LINES_DENSITY = new Metric.Builder(DUPLICATED_LINES_DENSITY_KEY, "Duplicated Lines (%)", Metric.ValueType.PERCENT) 1554 .setDescription("Duplicated lines balanced by statements") 1555 .setDirection(Metric.DIRECTION_WORST) 1556 .setQualitative(true) 1557 .setDomain(DOMAIN_DUPLICATIONS) 1558 .setWorstValue(50.0) 1559 .setBestValue(0.0) 1560 .setOptimizedBestValue(true) 1561 .create(); 1562 1563 /** 1564 * @since 6.1 1565 */ 1566 public static final String NEW_DUPLICATED_LINES_DENSITY_KEY = "new_duplicated_lines_density"; 1567 1568 /** 1569 * @since 6.1 1570 */ 1571 public static final Metric<Integer> NEW_DUPLICATED_LINES_DENSITY = new Metric.Builder(NEW_DUPLICATED_LINES_DENSITY_KEY, "Duplicated Lines on New Code (%)", 1572 Metric.ValueType.PERCENT) 1573 .setDescription("Duplicated lines on new code balanced by statements") 1574 .setDirection(Metric.DIRECTION_WORST) 1575 .setQualitative(true) 1576 .setDomain(DOMAIN_DUPLICATIONS) 1577 .setBestValue(0.0) 1578 .setDeleteHistoricalData(true) 1579 .create(); 1580 1581 /** 1582 * @deprecated since 4.5. Internal storage of duplication is not an API. 1583 */ 1584 @Deprecated 1585 public static final String DUPLICATIONS_DATA_KEY = "duplications_data"; 1586 1587 /** 1588 * Information about duplications, which is represented as an XML string. 1589 * <p> 1590 * Here is the format (since Sonar 2.12): 1591 * <pre> 1592 * {@literal 1593 * <duplications> 1594 * <!-- Multiple groups: --> 1595 * <g> 1596 * <!-- Multiple blocks: --> 1597 * <b r="[resource key]" s="[first line]" l="[number of lines]" /> 1598 * ... 1599 * </g> 1600 * ... 1601 * </duplications> 1602 * } 1603 * </pre> 1604 * 1605 * @deprecated since 4.5. Internal storage of duplication is not an API. 1606 */ 1607 @Deprecated 1608 public static final Metric<String> DUPLICATIONS_DATA = new Metric.Builder(DUPLICATIONS_DATA_KEY, "Duplication Details", Metric.ValueType.DATA) 1609 .setDescription("Duplications details") 1610 .setDirection(Metric.DIRECTION_NONE) 1611 .setQualitative(false) 1612 .setDomain(DOMAIN_DUPLICATIONS) 1613 .setDeleteHistoricalData(true) 1614 .create(); 1615 1616 // -------------------------------------------------------------------------------------------------------------------- 1617 // 1618 // CODING RULES 1619 // 1620 // -------------------------------------------------------------------------------------------------------------------- 1621 1622 public static final String VIOLATIONS_KEY = "violations"; 1623 public static final Metric<Integer> VIOLATIONS = new Metric.Builder(VIOLATIONS_KEY, "Issues", Metric.ValueType.INT) 1624 .setDescription("Issues") 1625 .setDirection(Metric.DIRECTION_WORST) 1626 .setQualitative(true) 1627 .setDomain(DOMAIN_ISSUES) 1628 .setBestValue(0.0) 1629 .setOptimizedBestValue(true) 1630 .create(); 1631 1632 public static final String BLOCKER_VIOLATIONS_KEY = "blocker_violations"; 1633 public static final Metric<Integer> BLOCKER_VIOLATIONS = new Metric.Builder(BLOCKER_VIOLATIONS_KEY, "Blocker Issues", Metric.ValueType.INT) 1634 .setDescription("Blocker issues") 1635 .setDirection(Metric.DIRECTION_WORST) 1636 .setQualitative(true) 1637 .setDomain(DOMAIN_ISSUES) 1638 .setBestValue(0.0) 1639 .setOptimizedBestValue(true) 1640 .create(); 1641 1642 public static final String CRITICAL_VIOLATIONS_KEY = "critical_violations"; 1643 public static final Metric<Integer> CRITICAL_VIOLATIONS = new Metric.Builder(CRITICAL_VIOLATIONS_KEY, "Critical Issues", Metric.ValueType.INT) 1644 .setDescription("Critical issues") 1645 .setDirection(Metric.DIRECTION_WORST) 1646 .setQualitative(true) 1647 .setDomain(DOMAIN_ISSUES) 1648 .setBestValue(0.0) 1649 .setOptimizedBestValue(true) 1650 .create(); 1651 1652 public static final String MAJOR_VIOLATIONS_KEY = "major_violations"; 1653 public static final Metric<Integer> MAJOR_VIOLATIONS = new Metric.Builder(MAJOR_VIOLATIONS_KEY, "Major Issues", Metric.ValueType.INT) 1654 .setDescription("Major issues") 1655 .setDirection(Metric.DIRECTION_WORST) 1656 .setQualitative(true) 1657 .setDomain(DOMAIN_ISSUES) 1658 .setBestValue(0.0) 1659 .setOptimizedBestValue(true) 1660 .create(); 1661 1662 public static final String MINOR_VIOLATIONS_KEY = "minor_violations"; 1663 public static final Metric<Integer> MINOR_VIOLATIONS = new Metric.Builder(MINOR_VIOLATIONS_KEY, "Minor Issues", Metric.ValueType.INT) 1664 .setDescription("Minor issues") 1665 .setDirection(Metric.DIRECTION_WORST) 1666 .setQualitative(true) 1667 .setDomain(DOMAIN_ISSUES) 1668 .setBestValue(0.0) 1669 .setOptimizedBestValue(true) 1670 .create(); 1671 1672 public static final String INFO_VIOLATIONS_KEY = "info_violations"; 1673 public static final Metric<Integer> INFO_VIOLATIONS = new Metric.Builder(INFO_VIOLATIONS_KEY, "Info Issues", Metric.ValueType.INT) 1674 .setDescription("Info issues") 1675 .setDirection(Metric.DIRECTION_WORST) 1676 .setQualitative(true) 1677 .setDomain(DOMAIN_ISSUES) 1678 .setBestValue(0.0) 1679 .setOptimizedBestValue(true) 1680 .create(); 1681 1682 public static final String NEW_VIOLATIONS_KEY = "new_violations"; 1683 public static final Metric<Integer> NEW_VIOLATIONS = new Metric.Builder(NEW_VIOLATIONS_KEY, "New Issues", Metric.ValueType.INT) 1684 .setDescription("New issues") 1685 .setDirection(Metric.DIRECTION_WORST) 1686 .setQualitative(true) 1687 .setDomain(DOMAIN_ISSUES) 1688 .setBestValue(0.0) 1689 .setOptimizedBestValue(true) 1690 .setDeleteHistoricalData(true) 1691 .create(); 1692 1693 public static final String NEW_BLOCKER_VIOLATIONS_KEY = "new_blocker_violations"; 1694 public static final Metric<Integer> NEW_BLOCKER_VIOLATIONS = new Metric.Builder(NEW_BLOCKER_VIOLATIONS_KEY, "New Blocker Issues", Metric.ValueType.INT) 1695 .setDescription("New Blocker issues") 1696 .setDirection(Metric.DIRECTION_WORST) 1697 .setQualitative(true) 1698 .setDomain(DOMAIN_ISSUES) 1699 .setBestValue(0.0) 1700 .setOptimizedBestValue(true) 1701 .setDeleteHistoricalData(true) 1702 .create(); 1703 1704 public static final String NEW_CRITICAL_VIOLATIONS_KEY = "new_critical_violations"; 1705 public static final Metric<Integer> NEW_CRITICAL_VIOLATIONS = new Metric.Builder(NEW_CRITICAL_VIOLATIONS_KEY, "New Critical Issues", Metric.ValueType.INT) 1706 .setDescription("New Critical issues") 1707 .setDirection(Metric.DIRECTION_WORST) 1708 .setQualitative(true) 1709 .setDomain(DOMAIN_ISSUES) 1710 .setBestValue(0.0) 1711 .setOptimizedBestValue(true) 1712 .setDeleteHistoricalData(true) 1713 .create(); 1714 1715 public static final String NEW_MAJOR_VIOLATIONS_KEY = "new_major_violations"; 1716 public static final Metric<Integer> NEW_MAJOR_VIOLATIONS = new Metric.Builder(NEW_MAJOR_VIOLATIONS_KEY, "New Major Issues", Metric.ValueType.INT) 1717 .setDescription("New Major issues") 1718 .setDirection(Metric.DIRECTION_WORST) 1719 .setQualitative(true) 1720 .setDomain(DOMAIN_ISSUES) 1721 .setBestValue(0.0) 1722 .setOptimizedBestValue(true) 1723 .setDeleteHistoricalData(true) 1724 .create(); 1725 1726 public static final String NEW_MINOR_VIOLATIONS_KEY = "new_minor_violations"; 1727 public static final Metric<Integer> NEW_MINOR_VIOLATIONS = new Metric.Builder(NEW_MINOR_VIOLATIONS_KEY, "New Minor Issues", Metric.ValueType.INT) 1728 .setDescription("New Minor issues") 1729 .setDirection(Metric.DIRECTION_WORST) 1730 .setQualitative(true) 1731 .setDomain(DOMAIN_ISSUES) 1732 .setBestValue(0.0) 1733 .setOptimizedBestValue(true) 1734 .setDeleteHistoricalData(true) 1735 .create(); 1736 1737 public static final String NEW_INFO_VIOLATIONS_KEY = "new_info_violations"; 1738 public static final Metric<Integer> NEW_INFO_VIOLATIONS = new Metric.Builder(NEW_INFO_VIOLATIONS_KEY, "New Info Issues", Metric.ValueType.INT) 1739 .setDescription("New Info issues") 1740 .setDirection(Metric.DIRECTION_WORST) 1741 .setQualitative(true) 1742 .setDomain(DOMAIN_ISSUES) 1743 .setBestValue(0.0) 1744 .setOptimizedBestValue(true) 1745 .setDeleteHistoricalData(true) 1746 .create(); 1747 1748 /** 1749 * @since 3.6 1750 */ 1751 public static final String FALSE_POSITIVE_ISSUES_KEY = "false_positive_issues"; 1752 1753 /** 1754 * @since 3.6 1755 */ 1756 public static final Metric<Integer> FALSE_POSITIVE_ISSUES = new Metric.Builder(FALSE_POSITIVE_ISSUES_KEY, "False Positive Issues", Metric.ValueType.INT) 1757 .setDescription("False positive issues") 1758 .setDirection(Metric.DIRECTION_WORST) 1759 .setDomain(DOMAIN_ISSUES) 1760 .setBestValue(0.0) 1761 .setOptimizedBestValue(true) 1762 .create(); 1763 1764 /** 1765 * @since 5.6 1766 */ 1767 public static final String WONT_FIX_ISSUES_KEY = "wont_fix_issues"; 1768 1769 /** 1770 * @since 5.6 1771 */ 1772 public static final Metric<Integer> WONT_FIX_ISSUES = new Metric.Builder(WONT_FIX_ISSUES_KEY, "Won't Fix Issues", Metric.ValueType.INT) 1773 .setDescription("Won't fix issues") 1774 .setDirection(Metric.DIRECTION_WORST) 1775 .setDomain(DOMAIN_ISSUES) 1776 .setBestValue(0.0) 1777 .setOptimizedBestValue(true) 1778 .create(); 1779 1780 /** 1781 * @since 3.6 1782 */ 1783 public static final String OPEN_ISSUES_KEY = "open_issues"; 1784 1785 /** 1786 * @since 3.6 1787 */ 1788 public static final Metric<Integer> OPEN_ISSUES = new Metric.Builder(OPEN_ISSUES_KEY, "Open Issues", Metric.ValueType.INT) 1789 .setDescription("Open issues") 1790 .setDirection(Metric.DIRECTION_WORST) 1791 .setDomain(DOMAIN_ISSUES) 1792 .setBestValue(0.0) 1793 .setOptimizedBestValue(true) 1794 .create(); 1795 1796 /** 1797 * @since 3.6 1798 */ 1799 public static final String REOPENED_ISSUES_KEY = "reopened_issues"; 1800 1801 /** 1802 * @since 3.6 1803 */ 1804 public static final Metric<Integer> REOPENED_ISSUES = new Metric.Builder(REOPENED_ISSUES_KEY, "Reopened Issues", Metric.ValueType.INT) 1805 .setDescription("Reopened issues") 1806 .setDirection(Metric.DIRECTION_WORST) 1807 .setQualitative(true) 1808 .setDomain(DOMAIN_ISSUES) 1809 .setBestValue(0.0) 1810 .setOptimizedBestValue(true) 1811 .create(); 1812 1813 /** 1814 * @since 3.6 1815 */ 1816 public static final String CONFIRMED_ISSUES_KEY = "confirmed_issues"; 1817 1818 /** 1819 * @since 3.6 1820 */ 1821 public static final Metric<Integer> CONFIRMED_ISSUES = new Metric.Builder(CONFIRMED_ISSUES_KEY, "Confirmed Issues", Metric.ValueType.INT) 1822 .setDescription("Confirmed issues") 1823 .setDirection(Metric.DIRECTION_WORST) 1824 .setQualitative(true) 1825 .setDomain(DOMAIN_ISSUES) 1826 .setBestValue(0.0) 1827 .setOptimizedBestValue(true) 1828 .create(); 1829 1830 /** 1831 * SonarQube Quality Model 1832 * @since 5.5 1833 */ 1834 public static final String CODE_SMELLS_KEY = "code_smells"; 1835 1836 /** 1837 * SonarQube Quality Model 1838 * @since 5.5 1839 */ 1840 public static final Metric<Integer> CODE_SMELLS = new Metric.Builder(CODE_SMELLS_KEY, "Code Smells", Metric.ValueType.INT) 1841 .setDescription("Code Smells") 1842 .setDirection(Metric.DIRECTION_WORST) 1843 .setQualitative(false) 1844 .setDomain(DOMAIN_MAINTAINABILITY) 1845 .setBestValue(0.0) 1846 .setOptimizedBestValue(true) 1847 .create(); 1848 1849 /** 1850 * SonarQube Quality Model 1851 * @since 5.5 1852 */ 1853 public static final String NEW_CODE_SMELLS_KEY = "new_code_smells"; 1854 1855 /** 1856 * SonarQube Quality Model 1857 * @since 5.5 1858 */ 1859 public static final Metric<Integer> NEW_CODE_SMELLS = new Metric.Builder(NEW_CODE_SMELLS_KEY, "New Code Smells", Metric.ValueType.INT) 1860 .setDescription("New Code Smells") 1861 .setDirection(Metric.DIRECTION_WORST) 1862 .setQualitative(true) 1863 .setDomain(DOMAIN_MAINTAINABILITY) 1864 .setBestValue(0.0) 1865 .setOptimizedBestValue(true) 1866 .setDeleteHistoricalData(true) 1867 .create(); 1868 1869 /** 1870 * SonarQube Quality Model 1871 * @since 5.5 1872 */ 1873 public static final String BUGS_KEY = "bugs"; 1874 1875 /** 1876 * SonarQube Quality Model 1877 * @since 5.5 1878 */ 1879 public static final Metric<Integer> BUGS = new Metric.Builder(BUGS_KEY, "Bugs", Metric.ValueType.INT) 1880 .setDescription("Bugs") 1881 .setDirection(Metric.DIRECTION_WORST) 1882 .setQualitative(false) 1883 .setDomain(DOMAIN_RELIABILITY) 1884 .setBestValue(0.0) 1885 .setOptimizedBestValue(true) 1886 .create(); 1887 1888 /** 1889 * SonarQube Quality Model 1890 * @since 5.5 1891 */ 1892 public static final String NEW_BUGS_KEY = "new_bugs"; 1893 1894 /** 1895 * SonarQube Quality Model 1896 * @since 5.5 1897 */ 1898 public static final Metric<Integer> NEW_BUGS = new Metric.Builder(NEW_BUGS_KEY, "New Bugs", Metric.ValueType.INT) 1899 .setDescription("New Bugs") 1900 .setDirection(Metric.DIRECTION_WORST) 1901 .setQualitative(true) 1902 .setDomain(DOMAIN_RELIABILITY) 1903 .setBestValue(0.0) 1904 .setOptimizedBestValue(true) 1905 .setDeleteHistoricalData(true) 1906 .create(); 1907 1908 /** 1909 * SonarQube Quality Model 1910 * @since 5.5 1911 */ 1912 public static final String VULNERABILITIES_KEY = "vulnerabilities"; 1913 1914 /** 1915 * SonarQube Quality Model 1916 * @since 5.5 1917 */ 1918 public static final Metric<Integer> VULNERABILITIES = new Metric.Builder(VULNERABILITIES_KEY, "Vulnerabilities", Metric.ValueType.INT) 1919 .setDescription("Vulnerabilities") 1920 .setDirection(Metric.DIRECTION_WORST) 1921 .setQualitative(false) 1922 .setDomain(DOMAIN_SECURITY) 1923 .setBestValue(0.0) 1924 .setOptimizedBestValue(true) 1925 .create(); 1926 1927 /** 1928 * SonarQube Quality Model 1929 * @since 5.5 1930 */ 1931 public static final String NEW_VULNERABILITIES_KEY = "new_vulnerabilities"; 1932 1933 /** 1934 * SonarQube Quality Model 1935 * @since 5.5 1936 */ 1937 public static final Metric<Integer> NEW_VULNERABILITIES = new Metric.Builder(NEW_VULNERABILITIES_KEY, "New Vulnerabilities", Metric.ValueType.INT) 1938 .setDescription("New Vulnerabilities") 1939 .setDirection(Metric.DIRECTION_WORST) 1940 .setQualitative(true) 1941 .setDomain(DOMAIN_SECURITY) 1942 .setBestValue(0.0) 1943 .setOptimizedBestValue(true) 1944 .setDeleteHistoricalData(true) 1945 .create(); 1946 1947 // -------------------------------------------------------------------------------------------------------------------- 1948 // 1949 // DESIGN 1950 // 1951 // -------------------------------------------------------------------------------------------------------------------- 1952 1953 /** 1954 * @deprecated since 5.0 this is an internal metric that should not be accessed by plugins 1955 */ 1956 @Deprecated 1957 public static final String DEPENDENCY_MATRIX_KEY = "dsm"; 1958 /** 1959 * @deprecated since 5.0 this is an internal metric that should not be accessed by plugins 1960 */ 1961 @Deprecated 1962 public static final transient Metric<String> DEPENDENCY_MATRIX = new Metric.Builder(DEPENDENCY_MATRIX_KEY, "Dependency Matrix", Metric.ValueType.DATA) 1963 .setDescription("Dependency Matrix") 1964 .setDirection(Metric.DIRECTION_NONE) 1965 .setQualitative(false) 1966 .setDomain(DOMAIN_DESIGN) 1967 .setDeleteHistoricalData(true) 1968 .create(); 1969 1970 /** 1971 * @deprecated since 5.2 No more design features 1972 */ 1973 @Deprecated 1974 public static final String DIRECTORY_CYCLES_KEY = "package_cycles"; 1975 /** 1976 * @deprecated since 5.2 No more design features 1977 */ 1978 @Deprecated 1979 public static final transient Metric<Integer> DIRECTORY_CYCLES = new Metric.Builder(DIRECTORY_CYCLES_KEY, "Directory Cycles", Metric.ValueType.INT) 1980 .setDescription("Directory cycles") 1981 .setDirection(Metric.DIRECTION_WORST) 1982 .setQualitative(true) 1983 .setDomain(DOMAIN_DESIGN) 1984 .setBestValue(0.0) 1985 .create(); 1986 1987 /** 1988 * @deprecated since 5.0 use {@link #DIRECTORY_CYCLES_KEY} 1989 */ 1990 @Deprecated 1991 public static final String PACKAGE_CYCLES_KEY = DIRECTORY_CYCLES_KEY; 1992 /** 1993 * @deprecated since 5.0 use {@link #DIRECTORY_CYCLES} 1994 */ 1995 @Deprecated 1996 public static final transient Metric<Integer> PACKAGE_CYCLES = DIRECTORY_CYCLES; 1997 1998 /** 1999 * @deprecated since 5.2 No more design features 2000 */ 2001 @Deprecated 2002 public static final String DIRECTORY_TANGLE_INDEX_KEY = "package_tangle_index"; 2003 /** 2004 * @deprecated since 5.2 No more design features 2005 */ 2006 @Deprecated 2007 public static final transient Metric<Double> DIRECTORY_TANGLE_INDEX = new Metric.Builder(DIRECTORY_TANGLE_INDEX_KEY, "Directory Tangle Index", Metric.ValueType.PERCENT) 2008 .setDescription("Directory tangle index") 2009 .setDirection(Metric.DIRECTION_WORST) 2010 .setQualitative(true) 2011 .setBestValue(0.0) 2012 .setDomain(DOMAIN_DESIGN) 2013 .create(); 2014 2015 /** 2016 * @deprecated since 5.0 use {@link #DIRECTORY_TANGLE_INDEX_KEY} 2017 */ 2018 @Deprecated 2019 public static final String PACKAGE_TANGLE_INDEX_KEY = DIRECTORY_TANGLE_INDEX_KEY; 2020 /** 2021 * @deprecated since 5.0 use {@link #DIRECTORY_TANGLE_INDEX} 2022 */ 2023 @Deprecated 2024 public static final transient Metric<Double> PACKAGE_TANGLE_INDEX = DIRECTORY_TANGLE_INDEX; 2025 2026 /** 2027 * @deprecated since 5.2 No more design features 2028 */ 2029 @Deprecated 2030 public static final String DIRECTORY_TANGLES_KEY = "package_tangles"; 2031 /** 2032 * @deprecated since 5.2 No more design features 2033 */ 2034 @Deprecated 2035 public static final transient Metric<Integer> DIRECTORY_TANGLES = new Metric.Builder(DIRECTORY_TANGLES_KEY, "File Dependencies to Cut", Metric.ValueType.INT) 2036 .setDescription("File dependencies to cut") 2037 .setDirection(Metric.DIRECTION_WORST) 2038 .setQualitative(false) 2039 .setDomain(DOMAIN_DESIGN) 2040 .create(); 2041 2042 /** 2043 * @deprecated since 5.0 use {@link #DIRECTORY_TANGLES_KEY} 2044 */ 2045 @Deprecated 2046 public static final String PACKAGE_TANGLES_KEY = DIRECTORY_TANGLES_KEY; 2047 /** 2048 * @deprecated since 5.0 use {@link #DIRECTORY_TANGLES} 2049 */ 2050 @Deprecated 2051 public static final transient Metric<Integer> PACKAGE_TANGLES = DIRECTORY_TANGLES; 2052 2053 /** 2054 * @deprecated since 5.2 No more design features 2055 */ 2056 @Deprecated 2057 public static final String DIRECTORY_FEEDBACK_EDGES_KEY = "package_feedback_edges"; 2058 /** 2059 * @deprecated since 5.2 No more design features 2060 */ 2061 @Deprecated 2062 public static final transient Metric<Integer> DIRECTORY_FEEDBACK_EDGES = new Metric.Builder(DIRECTORY_FEEDBACK_EDGES_KEY, "Package Dependencies to Cut", Metric.ValueType.INT) 2063 .setDescription("Package dependencies to cut") 2064 .setDirection(Metric.DIRECTION_WORST) 2065 .setQualitative(false) 2066 .setDomain(DOMAIN_DESIGN) 2067 .setBestValue(0.0) 2068 .create(); 2069 2070 /** 2071 * @deprecated since 5.0 use {@link #DIRECTORY_FEEDBACK_EDGES_KEY} 2072 */ 2073 @Deprecated 2074 public static final String PACKAGE_FEEDBACK_EDGES_KEY = DIRECTORY_FEEDBACK_EDGES_KEY; 2075 /** 2076 * @deprecated since 5.0 use {@link #DIRECTORY_FEEDBACK_EDGES} 2077 */ 2078 @Deprecated 2079 public static final transient Metric<Integer> PACKAGE_FEEDBACK_EDGES = DIRECTORY_FEEDBACK_EDGES; 2080 2081 /** 2082 * @deprecated since 5.2 No more design features 2083 */ 2084 @Deprecated 2085 public static final String DIRECTORY_EDGES_WEIGHT_KEY = "package_edges_weight"; 2086 /** 2087 * @deprecated since 5.2 No more design features 2088 */ 2089 @Deprecated 2090 public static final transient Metric<Integer> DIRECTORY_EDGES_WEIGHT = new Metric.Builder(DIRECTORY_EDGES_WEIGHT_KEY, "Directory Edges Weight", Metric.ValueType.INT) 2091 .setDescription("Directory edges weight") 2092 .setDirection(Metric.DIRECTION_BETTER) 2093 .setQualitative(false) 2094 .setDomain(DOMAIN_DESIGN) 2095 .setHidden(true) 2096 .setDeleteHistoricalData(true) 2097 .create(); 2098 2099 /** 2100 * @deprecated since 5.0 use {@link #DIRECTORY_EDGES_WEIGHT_KEY} 2101 */ 2102 @Deprecated 2103 public static final String PACKAGE_EDGES_WEIGHT_KEY = DIRECTORY_EDGES_WEIGHT_KEY; 2104 /** 2105 * @deprecated since 5.0 use {@link #DIRECTORY_EDGES_WEIGHT} 2106 */ 2107 @Deprecated 2108 public static final transient Metric<Integer> PACKAGE_EDGES_WEIGHT = DIRECTORY_EDGES_WEIGHT; 2109 2110 /** 2111 * @deprecated since 5.2 No more design features 2112 */ 2113 @Deprecated 2114 public static final String FILE_CYCLES_KEY = "file_cycles"; 2115 /** 2116 * @deprecated since 5.2 No more design features 2117 */ 2118 @Deprecated 2119 public static final transient Metric<Integer> FILE_CYCLES = new Metric.Builder(FILE_CYCLES_KEY, "File Cycles", Metric.ValueType.INT) 2120 .setDescription("File cycles") 2121 .setDirection(Metric.DIRECTION_WORST) 2122 .setQualitative(true) 2123 .setDomain(DOMAIN_DESIGN) 2124 .setHidden(true) 2125 .setDeleteHistoricalData(true) 2126 .setBestValue(0.0) 2127 .create(); 2128 2129 /** 2130 * @deprecated since 5.2 No more design features 2131 */ 2132 @Deprecated 2133 public static final String FILE_TANGLE_INDEX_KEY = "file_tangle_index"; 2134 /** 2135 * @deprecated since 5.2 No more design features 2136 */ 2137 @Deprecated 2138 public static final transient Metric<Double> FILE_TANGLE_INDEX = new Metric.Builder(FILE_TANGLE_INDEX_KEY, "File Tangle Index", Metric.ValueType.PERCENT) 2139 .setDescription("File tangle index") 2140 .setDirection(Metric.DIRECTION_WORST) 2141 .setQualitative(true) 2142 .setDomain(DOMAIN_DESIGN) 2143 .setHidden(true) 2144 .setDeleteHistoricalData(true) 2145 .setBestValue(0.0) 2146 .create(); 2147 2148 /** 2149 * @deprecated since 5.2 No more design features 2150 */ 2151 @Deprecated 2152 public static final String FILE_TANGLES_KEY = "file_tangles"; 2153 /** 2154 * @deprecated since 5.2 No more design features 2155 */ 2156 @Deprecated 2157 public static final transient Metric<Integer> FILE_TANGLES = new Metric.Builder(FILE_TANGLES_KEY, "File Tangles", Metric.ValueType.INT) 2158 .setDescription("Files tangles") 2159 .setDirection(Metric.DIRECTION_WORST) 2160 .setQualitative(false) 2161 .setDomain(DOMAIN_DESIGN) 2162 .setHidden(true) 2163 .setDeleteHistoricalData(true) 2164 .create(); 2165 2166 /** 2167 * @deprecated since 5.2 No more design features 2168 */ 2169 @Deprecated 2170 public static final String FILE_FEEDBACK_EDGES_KEY = "file_feedback_edges"; 2171 /** 2172 * @deprecated since 5.2 No more design features 2173 */ 2174 @Deprecated 2175 public static final transient Metric<Integer> FILE_FEEDBACK_EDGES = new Metric.Builder(FILE_FEEDBACK_EDGES_KEY, "Suspect File Dependencies", Metric.ValueType.INT) 2176 .setDescription("Suspect file dependencies") 2177 .setDirection(Metric.DIRECTION_WORST) 2178 .setQualitative(false) 2179 .setDomain(DOMAIN_DESIGN) 2180 .setHidden(true) 2181 .setDeleteHistoricalData(true) 2182 .setBestValue(0.0) 2183 .create(); 2184 2185 /** 2186 * @deprecated since 5.2 No more design features 2187 */ 2188 @Deprecated 2189 public static final String FILE_EDGES_WEIGHT_KEY = "file_edges_weight"; 2190 /** 2191 * @deprecated since 5.2 No more design features 2192 */ 2193 @Deprecated 2194 public static final transient Metric<Integer> FILE_EDGES_WEIGHT = new Metric.Builder(FILE_EDGES_WEIGHT_KEY, "File Edges Weight", Metric.ValueType.INT) 2195 .setDescription("File edges weight") 2196 .setDirection(Metric.DIRECTION_BETTER) 2197 .setQualitative(false) 2198 .setDomain(DOMAIN_DESIGN) 2199 .setHidden(true) 2200 .setDeleteHistoricalData(true) 2201 .create(); 2202 2203 // -------------------------------------------------------------------------------------------------------------------- 2204 // 2205 // SCM 2206 // 2207 // -------------------------------------------------------------------------------------------------------------------- 2208 2209 /** 2210 * @since 2.7 2211 * @deprecated since 5.0 SCM data will no more be stored as measures 2212 */ 2213 @Deprecated 2214 public static final String SCM_AUTHORS_BY_LINE_KEY = "authors_by_line"; 2215 2216 /** 2217 * Key-value pairs, where key - is a number of line, and value - is an author for this line. 2218 * 2219 * @see org.sonar.api.utils.KeyValueFormat#formatIntString(java.util.Map) 2220 * @see org.sonar.api.utils.KeyValueFormat#parseIntString(String) 2221 * @since 2.7 2222 * @deprecated since 5.0 SCM data will no more be stored as measures 2223 */ 2224 @Deprecated 2225 public static final transient Metric<String> SCM_AUTHORS_BY_LINE = new Metric.Builder(SCM_AUTHORS_BY_LINE_KEY, "Authors by Line", Metric.ValueType.DATA) 2226 .setDomain(DOMAIN_SCM) 2227 .create(); 2228 2229 /** 2230 * @since 2.7 2231 * @deprecated since 5.0 SCM data will no more be stored as measures 2232 */ 2233 @Deprecated 2234 public static final String SCM_REVISIONS_BY_LINE_KEY = "revisions_by_line"; 2235 2236 /** 2237 * Key-value pairs, where key - is a number of line, and value - is a revision for this line. 2238 * 2239 * @see org.sonar.api.utils.KeyValueFormat#formatIntString(java.util.Map) 2240 * @see org.sonar.api.utils.KeyValueFormat#parseIntString(String) 2241 * @since 2.7 2242 * @deprecated since 5.0 SCM data will no more be stored as measures 2243 */ 2244 @Deprecated 2245 public static final transient Metric<String> SCM_REVISIONS_BY_LINE = new Metric.Builder(SCM_REVISIONS_BY_LINE_KEY, "Revisions by Line", Metric.ValueType.DATA) 2246 .setDomain(DOMAIN_SCM) 2247 .create(); 2248 2249 /** 2250 * @since 2.7 2251 * @deprecated since 5.0 SCM data will no more be stored as measures 2252 */ 2253 @Deprecated 2254 public static final String SCM_LAST_COMMIT_DATETIMES_BY_LINE_KEY = "last_commit_datetimes_by_line"; 2255 2256 /** 2257 * Key-value pairs, where key - is a number of line, and value - is a date of last commit for this line. 2258 * 2259 * @see org.sonar.api.utils.KeyValueFormat#formatIntDateTime(java.util.Map) 2260 * @see org.sonar.api.utils.KeyValueFormat#parseIntDateTime(String) 2261 * @since 2.7 2262 * @deprecated since 5.0 SCM data will no more be stored as measures 2263 */ 2264 @Deprecated 2265 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", 2266 Metric.ValueType.DATA) 2267 .setDomain(DOMAIN_SCM) 2268 .create(); 2269 2270 // -------------------------------------------------------------------------------------------------------------------- 2271 // 2272 // MAINTAINABILITY CHARACTERISTIC 2273 // 2274 // -------------------------------------------------------------------------------------------------------------------- 2275 2276 /** 2277 * @since 4.0 2278 */ 2279 // TODO should be renamed to MAINTAINABILITY_REMEDIATION_EFFORT_KEY = "maintainability_remediation_effort" 2280 public static final String TECHNICAL_DEBT_KEY = "sqale_index"; 2281 2282 /** 2283 * @since 4.0 2284 */ 2285 // TODO should be renamed to MAINTAINABILITY_REMEDIATION_EFFORT 2286 public static final Metric<Long> TECHNICAL_DEBT = new Metric.Builder(TECHNICAL_DEBT_KEY, "Technical Debt", Metric.ValueType.WORK_DUR) 2287 .setDescription("Total effort (in days) to fix all the issues on the component and therefore to comply to all the requirements.") 2288 .setDomain(DOMAIN_MAINTAINABILITY) 2289 .setDirection(Metric.DIRECTION_WORST) 2290 .setOptimizedBestValue(true) 2291 .setBestValue(0.0) 2292 .setQualitative(true) 2293 .create(); 2294 2295 /** 2296 * @since 4.1 2297 */ 2298 // TODO should be renamed to NEW_MAINTAINABILITY_REMEDIATION_EFFORT_KEY = "new_maintainability_remediation_effort" 2299 public static final String NEW_TECHNICAL_DEBT_KEY = "new_technical_debt"; 2300 2301 /** 2302 * @since 4.1 2303 */ 2304 // TODO should be renamed to NEW_MAINTAINABILITY_REMEDIATION_EFFORT 2305 public static final Metric<Long> NEW_TECHNICAL_DEBT = new Metric.Builder(NEW_TECHNICAL_DEBT_KEY, "Added Technical Debt", Metric.ValueType.WORK_DUR) 2306 .setDescription("Added technical debt") 2307 .setDomain(DOMAIN_MAINTAINABILITY) 2308 .setDirection(Metric.DIRECTION_WORST) 2309 .setOptimizedBestValue(true) 2310 .setBestValue(0.0) 2311 .setQualitative(true) 2312 .setDeleteHistoricalData(true) 2313 .create(); 2314 2315 /** 2316 * @since 4.5 2317 */ 2318 // TODO should be renamed to MAINTAINABILITY_RATING_KEY = "maintainability_rating" 2319 public static final String SQALE_RATING_KEY = "sqale_rating"; 2320 2321 /** 2322 * @since 4.5 2323 */ 2324 // TODO should be renamed to MAINTAINABILITY_RATING 2325 public static final Metric<Integer> SQALE_RATING = new Metric.Builder(SQALE_RATING_KEY, "Maintainability Rating", Metric.ValueType.RATING) 2326 .setDescription("A-to-E rating based on the technical debt ratio") 2327 .setDomain(DOMAIN_MAINTAINABILITY) 2328 .setDirection(Metric.DIRECTION_WORST) 2329 .setQualitative(true) 2330 .setBestValue(1.0) 2331 .setWorstValue(5.0) 2332 .create(); 2333 2334 /** 2335 * @since 6.2 2336 */ 2337 public static final String NEW_MAINTAINABILITY_RATING_KEY = "new_maintainability_rating"; 2338 2339 /** 2340 * @since 6.2 2341 */ 2342 public static final Metric<Integer> NEW_MAINTAINABILITY_RATING = new Metric.Builder(NEW_MAINTAINABILITY_RATING_KEY, "Maintainability Rating on New Code", Metric.ValueType.RATING) 2343 .setDescription("Maintainability rating on new code") 2344 .setDomain(DOMAIN_MAINTAINABILITY) 2345 .setDirection(Metric.DIRECTION_WORST) 2346 .setDeleteHistoricalData(true) 2347 .setOptimizedBestValue(true) 2348 .setQualitative(true) 2349 .setBestValue(1.0) 2350 .setWorstValue(5.0) 2351 .create(); 2352 2353 /** 2354 * @since 4.5 2355 */ 2356 public static final String DEVELOPMENT_COST_KEY = "development_cost"; 2357 2358 /** 2359 * @since 4.5 2360 */ 2361 public static final Metric<String> DEVELOPMENT_COST = new Metric.Builder(DEVELOPMENT_COST_KEY, "SQALE Development Cost", Metric.ValueType.STRING) 2362 .setDescription("SQALE development cost") 2363 .setDomain(DOMAIN_MAINTAINABILITY) 2364 .setDirection(Metric.DIRECTION_WORST) 2365 .setOptimizedBestValue(true) 2366 .setBestValue(0.0) 2367 .setQualitative(true) 2368 .setHidden(true) 2369 .create(); 2370 2371 /** 2372 * @since 4.5 2373 */ 2374 // TODO should be renamed to TECHNICALDEBT_RATIO_KEY = "technicaldebt_ratio" 2375 public static final String SQALE_DEBT_RATIO_KEY = "sqale_debt_ratio"; 2376 2377 /** 2378 * @since 4.5 2379 */ 2380 // TODO should be renamed to TECHNICALDEBT_RATIO 2381 public static final Metric<Double> SQALE_DEBT_RATIO = new Metric.Builder(SQALE_DEBT_RATIO_KEY, "Technical Debt Ratio", Metric.ValueType.PERCENT) 2382 .setDescription("Ratio of the actual technical debt compared to the estimated cost to develop the whole source code from scratch") 2383 .setDomain(DOMAIN_MAINTAINABILITY) 2384 .setDirection(Metric.DIRECTION_WORST) 2385 .setOptimizedBestValue(true) 2386 .setBestValue(0.0) 2387 .setQualitative(true) 2388 .create(); 2389 2390 /** 2391 * @since 5.2 2392 */ 2393 // TODO should be renamed to TECHNICALDEBT_RATIO_ON_NEW_CODE_KEY = "technicaldebt_ratio_on_new_code" 2394 public static final String NEW_SQALE_DEBT_RATIO_KEY = "new_sqale_debt_ratio"; 2395 2396 /** 2397 * @since 5.2 2398 */ 2399 // TODO should be renamed to TECHNICALDEBT_RATIO_ON_NEW_CODE 2400 public static final Metric<Double> NEW_SQALE_DEBT_RATIO = new Metric.Builder(NEW_SQALE_DEBT_RATIO_KEY, "Technical Debt Ratio on New Code", Metric.ValueType.PERCENT) 2401 .setDescription("Technical Debt Ratio of new/changed code.") 2402 .setDomain(DOMAIN_MAINTAINABILITY) 2403 .setDirection(Metric.DIRECTION_WORST) 2404 .setOptimizedBestValue(true) 2405 .setBestValue(0.0) 2406 .setQualitative(true) 2407 .create(); 2408 2409 /** 2410 * @since 5.5 2411 */ 2412 public static final String EFFORT_TO_REACH_MAINTAINABILITY_RATING_A_KEY = "effort_to_reach_maintainability_rating_a"; 2413 2414 /** 2415 * @since 5.5 2416 */ 2417 public static final Metric<Long> EFFORT_TO_REACH_MAINTAINABILITY_RATING_A = new Metric.Builder(EFFORT_TO_REACH_MAINTAINABILITY_RATING_A_KEY, 2418 "Effort to Reach Maintainability Rating A", Metric.ValueType.WORK_DUR) 2419 .setDescription("Effort to reach maintainability rating A") 2420 .setDomain(DOMAIN_MAINTAINABILITY) 2421 .setDirection(Metric.DIRECTION_WORST) 2422 .setQualitative(true) 2423 .setBestValue(0.0) 2424 .setOptimizedBestValue(true) 2425 .create(); 2426 2427 // -------------------------------------------------------------------------------------------------------------------- 2428 // 2429 // RELIABILITY CHARACTERISTIC 2430 // 2431 // -------------------------------------------------------------------------------------------------------------------- 2432 2433 /** 2434 * @since 5.5 2435 */ 2436 public static final String RELIABILITY_REMEDIATION_EFFORT_KEY = "reliability_remediation_effort"; 2437 2438 /** 2439 * @since 5.5 2440 */ 2441 public static final Metric<Long> RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability Remediation Effort", 2442 Metric.ValueType.WORK_DUR) 2443 .setDescription("Reliability Remediation Effort") 2444 .setDomain(DOMAIN_RELIABILITY) 2445 .setDirection(Metric.DIRECTION_WORST) 2446 .setOptimizedBestValue(true) 2447 .setBestValue(0.0) 2448 .setQualitative(true) 2449 .create(); 2450 2451 /** 2452 * @since 5.5 2453 */ 2454 public static final String NEW_RELIABILITY_REMEDIATION_EFFORT_KEY = "new_reliability_remediation_effort"; 2455 2456 /** 2457 * @since 5.5 2458 */ 2459 public static final Metric<Long> NEW_RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability Remediation Effort on New Code", 2460 Metric.ValueType.WORK_DUR) 2461 .setDescription("Reliability remediation effort on new code") 2462 .setDomain(DOMAIN_RELIABILITY) 2463 .setDirection(Metric.DIRECTION_WORST) 2464 .setOptimizedBestValue(true) 2465 .setBestValue(0.0) 2466 .setQualitative(true) 2467 .setDeleteHistoricalData(true) 2468 .create(); 2469 2470 /** 2471 * @since 5.5 2472 */ 2473 public static final String RELIABILITY_RATING_KEY = "reliability_rating"; 2474 2475 /** 2476 * @since 5.5 2477 */ 2478 public static final Metric<Integer> RELIABILITY_RATING = new Metric.Builder(RELIABILITY_RATING_KEY, "Reliability Rating", Metric.ValueType.RATING) 2479 .setDescription("Reliability rating") 2480 .setDomain(DOMAIN_RELIABILITY) 2481 .setDirection(Metric.DIRECTION_WORST) 2482 .setQualitative(true) 2483 .setBestValue(1.0) 2484 .setWorstValue(5.0) 2485 .create(); 2486 2487 /** 2488 * @since 6.2 2489 */ 2490 public static final String NEW_RELIABILITY_RATING_KEY = "new_reliability_rating"; 2491 2492 /** 2493 * @since 6.2 2494 */ 2495 public static final Metric<Integer> NEW_RELIABILITY_RATING = new Metric.Builder(NEW_RELIABILITY_RATING_KEY, "Reliability Rating on New Code", Metric.ValueType.RATING) 2496 .setDescription("Reliability rating on new code") 2497 .setDomain(DOMAIN_RELIABILITY) 2498 .setDirection(Metric.DIRECTION_WORST) 2499 .setDeleteHistoricalData(true) 2500 .setOptimizedBestValue(true) 2501 .setQualitative(true) 2502 .setBestValue(1.0) 2503 .setWorstValue(5.0) 2504 .create(); 2505 2506 // -------------------------------------------------------------------------------------------------------------------- 2507 // 2508 // SECURITY CHARACTERISTIC 2509 // 2510 // -------------------------------------------------------------------------------------------------------------------- 2511 2512 /** 2513 * @since 5.5 2514 */ 2515 public static final String SECURITY_REMEDIATION_EFFORT_KEY = "security_remediation_effort"; 2516 2517 /** 2518 * @since 5.5 2519 */ 2520 public static final Metric<Long> SECURITY_REMEDIATION_EFFORT = new Metric.Builder(SECURITY_REMEDIATION_EFFORT_KEY, "Security Remediation Effort", Metric.ValueType.WORK_DUR) 2521 .setDescription("Security remediation effort") 2522 .setDomain(DOMAIN_SECURITY) 2523 .setDirection(Metric.DIRECTION_WORST) 2524 .setOptimizedBestValue(true) 2525 .setBestValue(0.0) 2526 .setQualitative(true) 2527 .create(); 2528 2529 /** 2530 * @since 5.5 2531 */ 2532 public static final String NEW_SECURITY_REMEDIATION_EFFORT_KEY = "new_security_remediation_effort"; 2533 2534 /** 2535 * @since 5.5 2536 */ 2537 public static final Metric<Long> NEW_SECURITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_SECURITY_REMEDIATION_EFFORT_KEY, "Security Remediation Effort on New Code", 2538 Metric.ValueType.WORK_DUR) 2539 .setDescription("Security remediation effort on new code") 2540 .setDomain(DOMAIN_SECURITY) 2541 .setDirection(Metric.DIRECTION_WORST) 2542 .setOptimizedBestValue(true) 2543 .setBestValue(0.0) 2544 .setQualitative(true) 2545 .setDeleteHistoricalData(true) 2546 .create(); 2547 2548 /** 2549 * @since 5.5 2550 */ 2551 public static final String SECURITY_RATING_KEY = "security_rating"; 2552 2553 /** 2554 * @since 5.5 2555 */ 2556 public static final Metric<Integer> SECURITY_RATING = new Metric.Builder(SECURITY_RATING_KEY, "Security Rating", Metric.ValueType.RATING) 2557 .setDescription("Security rating") 2558 .setDomain(DOMAIN_SECURITY) 2559 .setDirection(Metric.DIRECTION_WORST) 2560 .setQualitative(true) 2561 .setBestValue(1.0) 2562 .setWorstValue(5.0) 2563 .create(); 2564 2565 /** 2566 * @since 6.2 2567 */ 2568 public static final String NEW_SECURITY_RATING_KEY = "new_security_rating"; 2569 2570 /** 2571 * @since 6.2 2572 */ 2573 public static final Metric<Integer> NEW_SECURITY_RATING = new Metric.Builder(NEW_SECURITY_RATING_KEY, "Security Rating on New Code", Metric.ValueType.RATING) 2574 .setDescription("Security rating on new code") 2575 .setDomain(DOMAIN_SECURITY) 2576 .setDirection(Metric.DIRECTION_WORST) 2577 .setDeleteHistoricalData(true) 2578 .setOptimizedBestValue(true) 2579 .setQualitative(true) 2580 .setBestValue(1.0) 2581 .setWorstValue(5.0) 2582 .create(); 2583 2584 // -------------------------------------------------------------------------------------------------------------------- 2585 // 2586 // FILE DATA 2587 // 2588 // -------------------------------------------------------------------------------------------------------------------- 2589 2590 /** 2591 * @since 2.14 2592 */ 2593 public static final String NCLOC_DATA_KEY = "ncloc_data"; 2594 2595 /** 2596 * Information about lines of code in file. 2597 * Key-value pairs, where key - is a number of line, and value - is an indicator of whether line contains code (1) or not (0). 2598 * If a line number is missing in the map it is equivalent to the default value (0). 2599 * 2600 * @see org.sonar.api.measures.FileLinesContext 2601 * @since 2.14 2602 */ 2603 public static final Metric<String> NCLOC_DATA = new Metric.Builder(NCLOC_DATA_KEY, "ncloc_data", Metric.ValueType.DATA) 2604 .setHidden(true) 2605 .setDomain(DOMAIN_SIZE) 2606 .create(); 2607 2608 /** 2609 * @since 2.14 2610 */ 2611 public static final String COMMENT_LINES_DATA_KEY = "comment_lines_data"; 2612 2613 /** 2614 * Information about comments in file. 2615 * Key-value pairs, where key - is a number of line, and value - is an indicator of whether line contains comment (1) or not (0). 2616 * If a line number is missing in the map it is equivalent to the default value (0). 2617 * 2618 * @see org.sonar.api.measures.FileLinesContext 2619 * @since 2.14 2620 */ 2621 public static final Metric<String> COMMENT_LINES_DATA = new Metric.Builder(COMMENT_LINES_DATA_KEY, "comment_lines_data", Metric.ValueType.DATA) 2622 .setHidden(true) 2623 .setDomain(DOMAIN_SIZE) 2624 .create(); 2625 2626 /** 2627 * @since 5.5 2628 */ 2629 public static final String EXECUTABLE_LINES_DATA_KEY = "executable_lines_data"; 2630 2631 /** 2632 * Information about executable lines of code in file. 2633 * Key-value pairs, where key - is a number of line, and value - is an indicator of whether line contains executable code (1) or not (0). 2634 * If a line number is missing in the map it is equivalent to the default value (0). 2635 * 2636 * @see org.sonar.api.measures.FileLinesContext 2637 * @since 5.5 2638 */ 2639 public static final Metric<String> EXECUTABLE_LINES_DATA = new Metric.Builder(EXECUTABLE_LINES_DATA_KEY, "executable_lines_data", Metric.ValueType.DATA) 2640 .setHidden(true) 2641 .setDomain(DOMAIN_COVERAGE) 2642 .create(); 2643 2644 // -------------------------------------------------------------------------------------------------------------------- 2645 // 2646 // OTHERS 2647 // 2648 // -------------------------------------------------------------------------------------------------------------------- 2649 2650 public static final String ALERT_STATUS_KEY = "alert_status"; 2651 public static final Metric<Metric.Level> ALERT_STATUS = new Metric.Builder(ALERT_STATUS_KEY, "Quality Gate Status", Metric.ValueType.LEVEL) 2652 .setDescription("The project status with regard to its quality gate.") 2653 .setDirection(Metric.DIRECTION_BETTER) 2654 .setQualitative(true) 2655 .setDomain(DOMAIN_RELEASABILITY) 2656 .create(); 2657 2658 /** 2659 * @since 4.4 2660 */ 2661 public static final String QUALITY_GATE_DETAILS_KEY = "quality_gate_details"; 2662 /** 2663 * The project detailed status with regard to its quality gate. 2664 * Storing the global quality gate status, along with all evaluated conditions, into a JSON object. 2665 * @since 4.4 2666 */ 2667 public static final Metric<String> QUALITY_GATE_DETAILS = new Metric.Builder(QUALITY_GATE_DETAILS_KEY, "Quality Gate Details", Metric.ValueType.DATA) 2668 .setDescription("The project detailed status with regard to its quality gate") 2669 .setDomain(DOMAIN_GENERAL) 2670 .create(); 2671 2672 /** 2673 * @since 4.4 2674 * @deprecated since 5.5 2675 */ 2676 @Deprecated 2677 public static final String QUALITY_PROFILES_KEY = "quality_profiles"; 2678 2679 /** 2680 * @since 4.4 2681 * @deprecated since 5.5 2682 */ 2683 @Deprecated 2684 public static final Metric<String> QUALITY_PROFILES = new Metric.Builder(QUALITY_PROFILES_KEY, "Profiles", Metric.ValueType.DATA) 2685 .setDescription("Details of quality profiles used during analysis") 2686 .setQualitative(false) 2687 .setDomain(DOMAIN_GENERAL) 2688 .setHidden(true) 2689 .create(); 2690 2691 /** 2692 * @since 5.2 2693 */ 2694 public static final String LAST_COMMIT_DATE_KEY = "last_commit_date"; 2695 2696 /** 2697 * Date of the most recent commit. Current implementation is based on commits touching lines of source code. It 2698 * ignores other changes like file renaming or file deletion. 2699 * @since 5.2 2700 */ 2701 public static final Metric LAST_COMMIT_DATE = new Metric.Builder(LAST_COMMIT_DATE_KEY, "Date of Last Commit", Metric.ValueType.MILLISEC) 2702 .setDomain(CoreMetrics.DOMAIN_SCM) 2703 // waiting for type "datetime" to be correctly handled 2704 .setHidden(true) 2705 .create(); 2706 2707 private static final List<Metric> METRICS; 2708 2709 static { 2710 METRICS = new LinkedList<>(); 2711 for (Field field : CoreMetrics.class.getFields()) { 2712 if (!Modifier.isTransient(field.getModifiers()) && Metric.class.isAssignableFrom(field.getType())) { 2713 try { 2714 Metric metric = (Metric) field.get(null); 2715 METRICS.add(metric); 2716 } catch (IllegalAccessException e) { 2717 throw new SonarException("can not introspect " + CoreMetrics.class + " to get metrics", e); 2718 } 2719 } 2720 } 2721 } 2722 2723 private CoreMetrics() { 2724 // only static stuff 2725 } 2726 2727 public static List<Metric> getMetrics() { 2728 return METRICS; 2729 } 2730 2731 public static Metric getMetric(final String key) { 2732 return METRICS.stream().filter(metric -> metric != null && metric.getKey().equals(key)).findFirst().orElseThrow(NoSuchElementException::new); 2733 } 2734}