Skip to Content
GuidesSet Up Quality Gates

Set Up Quality Gates

Quality gates define the minimum standards your code must meet. When a scan or PR review runs, CodeStax evaluates the results against your gate conditions. If any condition fails, the gate fails — and you can optionally block merges until issues are resolved.

What Quality Gates Check

Setting Up Your First Quality Gate

Configuration Reference

Core Gate Settings

SettingTypeDefaultDescription
Risk ThresholdSlider (0-100)75Maximum acceptable risk score. Lower = stricter
Block Merge on Gate FailureToggleOffWhen enabled, PRs that fail the gate cannot be merged
Reliability RatingA-E selectorA, BMinimum acceptable reliability grade
Security RatingA-E selectorAMinimum acceptable security grade
Maintainability RatingA-E selectorA, B, CMinimum acceptable maintainability grade
Max Cyclomatic ComplexitySlider (0-100)60Maximum complexity score before gate fails
Max Critical IssuesDropdown0 (Zero tolerance)Maximum critical findings allowed
Max High IssuesDropdownUnlimitedMaximum high-severity findings allowed

Code Quality Gate Settings

SettingTypeDefaultDescription
Fail on Dead CodeToggleOffFail the gate if dead/unreachable code is detected
Fail on Duplicates Above %Slider (0-50%)Disabled (0)Fail the gate if code duplication exceeds this percentage

How Gates Are Evaluated

Quality gates use an all-must-pass model. Every configured condition is checked independently:

Gate Result = ALL conditions must pass Condition 1: Risk Score (45) < Threshold (75) ✓ Pass Condition 2: Reliability Rating (B) in [A, B] ✓ Pass Condition 3: Security Rating (B) in [A] ✗ FAIL Condition 4: Complexity Score (38) < Max (60) ✓ Pass Condition 5: Critical Issues (0) <= Max (0) ✓ Pass Overall: FAILED (Security rating B not in allowed [A])

The quality gate status appears on:

  • The Code Health Dashboard as a pass/fail badge
  • PR review comments posted to GitHub, GitLab, or Bitbucket
  • Commit status checks that block or allow merging

Per-Repository Overrides

Different repositories may need different standards. A greenfield microservice might have strict gates, while a legacy monolith needs more lenient ones.

For teams new to quality gates:

SettingRecommended StartTighten To (After 1 Month)
Risk Threshold7560
ReliabilityA, B, CA, B
SecurityA, BA
MaintainabilityA, B, CA, B, C
Max Critical00
Max HighUnlimited10
Block MergeOffOn