- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
using git scm
- what are you trying to achieve
Quality gate for “Coverage on New Code”. Sonar reports this as a “—” in the UI.
- what have you tried so far to achieve this
My understanding is:
- Coverage on new code quality gate will only be checked if new lines of code > 20
- Coverage on new code is determined using the SCM provider blame function
What I am doing:
Create a long lived branch feature/long-lived, initialize a BASELINE version of the sonar scan from the main branch (master). I do this by running sonar scanner on master but passing in sonar.branch.name=feature/long-lived and sonar.projectVersion=BASELINE – This step works
Run sonar scan on feature/long-lived using the same branch name and a new projectVersion for the latest commits. – This step also works.
(Step 1 and 2 are ran in the same jenkins multipipeline. Am I possibly running into some kind of cache issue? I’ve tried using sonar.scm.forceReloadAll=true and this didn’t help)
At this point my activity looks like the following:
- At this point sonar is not displaying any metrics for coverage or duplications
- Here is the coverage graph for the time period:
As you can see lines have changed more than 20 and also coverage was correctly reported into sonar. Is there something else I am missing around this?