> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codeant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quality Gates

> Configure CodeAnt AI pull request Quality gates

## What Are Quality Gates?

Quality Gates are sets of conditions based on code metrics (coverage, bugs, security issues, complexity, etc.) that must pass for code to be considered acceptable. They automatically fail pull requests or flag commits that don't meet your quality standards.

***

## How to Set Up Quality Gates

### Step 1: Access Analysis Configuration

1. **Log into CodeAnt**\
   Go to [app.codeant.ai](https://app.codeant.ai) and sign in with your account.

2. **Navigate to Settings**\
   Click on the **Settings** tab in the top navigation bar.

3. **Open Analysis Configuration**\
   In the sidebar, select **Analysis Configuration** or go directly to [app.codeant.ai/settings/analysis-configuration](https://app.codeant.ai/settings/analysis-configuration).

### Step 2: Add Quality Gate Conditions

<img src="https://mintcdn.com/codeantai/cPAPWnajTUNzakyT/images/pull_request/quality_gates/setup/add_condition.png?fit=max&auto=format&n=cPAPWnajTUNzakyT&q=85&s=c6d71353f83f5f75a6b37852de75253b" alt="Quality Gate Configuration" width="2892" height="1790" data-path="images/pull_request/quality_gates/setup/add_condition.png" />

1. \*\* Enable Quality Gates \*\*
   Enable the quality gates.

2. **Click "Add Condition"**\
   On the Analysis Configuration page, click the **Add Condition** button.

3. **Configure Your Condition**
   * **Metric**: Select the code quality metric you want to monitor (e.g., Code Coverage, Bugs, Security Issues)
   * **Operator**: Choose the comparison operator (e.g., "is less than", "is greater than", "equals")
   * **Value**: Enter the threshold value for this metric
   * **Scope**: Select where this condition applies:
     * ✅ **Commit**: Apply to individual commits
     * ✅ **Pull Request**: Apply to pull requests
     * You must select at least one scope

4. **Save the Condition**\
   Click **Add Condition** to save your quality gate rule.

5. **Add Multiple Conditions**\
   Repeat the process to add as many conditions as needed. All conditions must pass for the quality gate to succeed.

***

## What Happens When a Quality Gate Fails?

When your code doesn't meet the configured quality gate conditions:

1. **For Pull Requests**:
   * A failing status check appears on your PR
   * The merge button may be disabled (depending on your Git provider settings)
   * Team members are notified of the quality issues
   * Detailed failure reasons are shown in the PR comments

2. **For Commits**:
   * The commit is flagged in CodeAnt's dashboard
   * Quality metrics are tracked for reporting
   * Teams receive notifications based on their alert preferences

3. **Resolution**:
   * Fix the identified issues in your code
   * Push the changes to trigger a re-analysis
   * Once all conditions pass, the quality gate succeeds
   * Your PR can be safely merged
