The SonarQube quality gate must block merging PRs that add new bugs, vulnerabilities or uncovered code.
IntermediateScenarioBuilds, Artifacts, Nexus, SonarQube and Testing
Answer
Situation read → Gate on new code, not the legacy backlog.
What I'd do →
- Define the gate on "Clean as You Code" conditions: no new bugs/vulnerabilities, coverage on new code at least 80%, duplications on new code under 3%.
- In CI run the scanner with
-Dsonar.qualitygate.wait=trueso the step fails on a failed gate. - Decorate the PR and make the Sonar check required.
Why → New-code gating prevents debt from growing without demanding a big-bang cleanup.
Interview tip → Mention "Clean as You Code".
More on Builds, Artifacts, Nexus, SonarQube and Testing
A Maven project resolves dependencies from Maven Central on every build and a left-pad style outage would stop all builds.BeginnerYou must publish snapshot and release artifacts without overwriting a released version.IntermediateEvery merge to main should produce a unique semantic version automatically.IntermediateAn npm build is non-reproducible: different versions install on different days.BeginnerCoverage shows 0% in SonarQube although tests run in CI.IntermediateA big legacy codebase fails every Sonar gate. Teams ignore the tool. How do you adopt it?Intermediate