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