Quality Gates

Enforce code quality standards automatically. Set thresholds that must be met before code can be merged.

Overview

Quality Gates allow you to define minimum standards for code reviews. When a PR fails to meet your thresholds, Jasper can either warn the team or block the PR from being merged. This ensures consistent code quality across your entire organization.

Two-Level Configuration

Quality gates can be set at the organization level (defaults for all repos) and repository level (custom overrides). Repos inherit org defaults unless customized.

How It Works

  1. Review completes - Jasper analyzes your PR and categorizes issues by severity
  2. Thresholds checked - Issue counts are compared against your quality gate settings
  3. Result determined - PR passes or fails based on whether thresholds are exceeded
  4. Action taken - In warning mode, comments are posted; in blocking mode, the PR is blocked

Available Thresholds

Configure limits for each type of issue:

Threshold Description Default
Max Critical Issues Maximum number of critical severity issues allowed 0
Max High Issues Maximum number of high severity issues allowed 2
Max Medium Issues Maximum number of medium severity issues allowed 5
Max Security Issues Maximum number of security-related issues allowed 0
Minimum Quality Score Minimum overall quality score required (0-100) 70

Enforcement Modes

Choose how strictly quality gates are enforced:

Warning Mode (Recommended for Starting)

When a PR fails quality gates in warning mode:

  • Jasper posts a comment explaining which thresholds were exceeded
  • The PR can still be merged
  • Team members are notified but not blocked

Blocking Mode

When a PR fails quality gates in blocking mode:

  • Jasper sets a failing commit status on the PR
  • The PR cannot be merged until issues are resolved
  • Requires branch protection rules to be enabled in GitHub

Blocking Mode Requirement

For blocking mode to work, you must configure GitHub branch protection to require the Jasper status check. See Branch Protection for setup instructions.

Organization Quality Gates

Set default quality gates that apply to all repositories:

  1. Go to Settings from the main navigation
  2. Click Quality Gates in the sidebar
  3. Toggle Enable Quality Gates to activate
  4. Set your desired thresholds
  5. Choose enforcement mode (Warning or Blocking)
  6. Click Save Changes

Apply to All Repositories

Use the Apply to All Repositories button to reset all repositories to use organization defaults. This is useful when standardizing quality requirements across your codebase.

Auto-Apply to New Repos

Enable Apply to new repositories to automatically configure quality gates when you add new repositories to Jasper.

Repository Quality Gates

Override organization defaults for specific repositories:

  1. Go to Repositories and select a repository
  2. Click the Settings tab
  3. Scroll to Quality Gate Thresholds
  4. Modify thresholds as needed
  5. Click Save Changes

Note: When you save custom settings for a repository, it automatically switches from using organization defaults to using its own settings. A banner will appear showing which mode is active.

Switching Back to Org Defaults

To have a repository use organization defaults again:

  1. Go to the repository's quality gate settings
  2. Click Use Organization Defaults
  3. The repository will now inherit from the organization

Quality Gate Results

After each review, quality gate results are displayed in:

  • PR Comments - Summary of pass/fail with threshold details
  • Review Details - Full breakdown on the review page in Jasper
  • GitHub Status - Pass/fail status visible in the PR (blocking mode)
  • Dashboard - Aggregate quality metrics across all repos

Best Practices

Starting Out

  • Begin with warning mode to understand your baseline
  • Set conservative thresholds initially (allow more issues)
  • Review quality gate reports for a few weeks
  • Gradually tighten thresholds as your team adapts

Mature Teams

  • Use blocking mode for critical repositories
  • Set zero tolerance for critical and security issues
  • Use higher thresholds for experimental or prototype repos
  • Review and adjust thresholds quarterly

Different Standards by Repo Type

Consider different thresholds based on repository purpose:

  • Production apps - Strict (0 critical, 0 security, 80+ score)
  • Internal tools - Moderate (1 critical, 0 security, 70+ score)
  • Prototypes/POCs - Lenient (5 critical, 2 security, 50+ score)

Troubleshooting

Quality gates not blocking PRs

  • Verify enforcement mode is set to "Blocking"
  • Check that GitHub branch protection requires Jasper status
  • Ensure the repository isn't using custom settings that override org defaults

Too many PRs failing

  • Review your thresholds - they may be too strict for your current codebase
  • Consider starting with warning mode to establish a baseline
  • Focus on critical and security issues first, relax medium thresholds

Inconsistent results across repos

  • Check which repos have custom settings vs using org defaults
  • Use "Apply to All" to standardize settings
  • Review the repo settings page to see which mode is active