We’ve discovered that our new code no longer fails the quality gate. This used to work perfectly, but stopped a few months ago.
I created a new, short-lived branch and introduced overly complex code so that SonarCloud would raise new issues. We use Sonar’s built-in quality gate, which allows no new issues (A = 0 or more info issues). My new code raises one medium and one high maintainability issue.
While the branch summary page correctly displays the number of new lines and issues, the quality gate shows ‘passed’.
On the ‘Overview’ page, under ‘Latest activity’, the same branch shows zero issues and zero new lines. Perhaps this is because I started the analysis several times?
What I have tried so far:
- Set new code from “previous version” to “number of days”
- Update scanner image
- Setting “Ignore duplication and coverage on small changes” to false
When we introduced SonarQube at the beginning of this year, this worked perfectly, but a few months ago it stopped working. Could there have been some changes in the SonarCloud version that have led to this behaviour?
Here is what we use:
- CI: Jenkins
- Languages of the repository: Multiple (Monorepo: TS, Java, phoenix, …)
- Scanner command used:
docker run --rm -v ${WORKSPACE}:/usr/src
-w /usr/src/...
-e SONAR_SCANNER_OPTS="-Dsonar.branch.name='+env.BRANCH_NAME+'"
-e SONAR_TOKEN=' + token + ' ' +
sonarsource/sonar-scanner-cli:11.2
Due to the size of our repository, we use a shallow clone. Perhaps this is the root cause of the problem. However, as I mentioned, it worked previously and we did not change the Git checkout.