Quality Gates
Enforce minimum mutation score thresholds in CI/CD pipelines.
Basic Usage
Fail if mutation score drops below a threshold:
mutagoph run --min-score 80
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success, quality gate passed |
| 1 | Error during execution |
| Non-zero | Quality gate failed |
Configuration
Command Line
mutagoph run --min-score 80
Config File
min_mutation_score: 80.0
Environment Variable
export MUTAGOPH_MIN_MUTATION_SCORE=80
mutagoph run
Per-Package Thresholds
Set different thresholds for different packages:
# Global threshold
min_mutation_score: 70.0
# Package-specific thresholds
package_thresholds:
github.com/myorg/myapp/core: 90.0
github.com/myorg/myapp/auth: 95.0
github.com/myorg/myapp/utils: 60.0
CI Integration
GitHub Actions
- name: Mutation Testing
run: mutagoph run --min-score 80
# Job fails if score < 80%
With Diff-Based Testing
- name: Mutation Testing
run: |
mutagoph run \
--diff-base origin/main \
--min-score 70 \
--mutations standard
Quality Gate Output
When quality gate fails:
❌ QUALITY GATE FAILED: Mutation score 65.0% is below threshold 80.0%
When quality gate passes:
✓ QUALITY GATE PASSED: Mutation score 85.0% meets threshold 80.0%
Recommended Thresholds
| Project Type | Suggested Threshold |
|---|---|
| New project | 70% |
| Mature project | 80% |
| Critical code | 90% |
| Utilities | 60% |
Start with a lower threshold and increase it as you improve test coverage.