cicd
code_quality
ai_generated
true
Quality Gate failed: Reliability Rating worse than A, Security Hotspots Reviewed less than 100%, Coverage on New Code less than 80%
ID: cicd/sonarqube-quality-gate
80%Fix Rate
84%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| any | active | — | — | — |
Root Cause
SonarQube Quality Gate check failed because one or more metrics (coverage, duplication, reliability, security, maintainability) did not meet the configured thresholds for new code.
genericWorkarounds
-
85% success Review the SonarQube dashboard and fix issues on new code
Open the SonarQube project dashboard. Click on the failed Quality Gate conditions. Focus on new code issues: fix bugs, resolve security hotspots, add tests for uncovered new code. The Quality Gate typically only checks new/changed code.
-
82% success Configure the SonarQube analysis to focus on the correct scope
Set sonar.newCode.referenceBranch=main to compare against the main branch. Ensure sonar.coverage.jacoco.xmlReportPaths (Java) or other coverage report paths point to the correct files. Verify that the coverage report is generated before the SonarQube scan.
Dead Ends
Common approaches that don't work:
-
Lowering Quality Gate thresholds to make the pipeline pass
60% fail
This defeats the purpose of quality gates. Technical debt accumulates, and code quality degrades continuously.
-
Skipping SonarQube analysis on the branch
70% fail
This bypasses the quality gate entirely. If the branch is merged, low-quality code enters the main branch without review.
Error Chain
Leads to:
Preceded by:
Frequently confused with: