Understanding Delta Analysis Results and Quality Gates in CodeScene

Overview

We understand that delta analysis results can sometimes be confusing. This article aims to clarify how CodeScene evaluates pull requests (PRs) and enforces quality gates to maintain code health standards.

How CodeScene Quality Gates Work

CodeScene’s quality gates are designed to enforce specific thresholds and standards for code health across various metrics. These gates act as checkpoints to ensure that your code meets predefined quality criteria before being merged.

  • Metrics-Based Evaluation: CodeScene evaluates code health using several metrics, such as lines of code (LoC), complexity, and duplication.
  • Granular Analysis: A PR might show an overall improvement while still failing the quality gate if certain metrics or thresholds are not met.

Common Scenarios in Delta Analysis

  1. Mixed Metric Outcomes: A file can show improvement in one area (e.g., reduced LoC) but deteriorate in another (e.g., increased complexity).
  2. Partial Threshold Fulfillment: A PR might improve the overall quality but still fail the quality gate because one or more metrics do not meet the required thresholds.
  3. Critical Issues Remain: Even with positive progress, unresolved critical issues may result in a failed quality gate.
  4. Average Code Health Decline: The average code health may fall below the specified threshold without causing the quality gate to fail. However, the quality gate fails if any file under review has a code health score below the specified threshold and includes an unsuppressed problem introduced in the PR that decreases its health score.

Key Takeaways

  • CodeScene’s quality gates ensure all aspects of code quality are consistently addressed.
  • A failed quality gate signals the need for additional refinements to meet all thresholds, ensuring high-quality code.

Additional Resources

For more information on delta analysis and quality gates, refer to our Delta Analysis Use Cases and Quality Gates documentation.

By understanding these details, you can better interpret Delta analysis results and work towards consistently meeting CodeScene’s quality standards.