New Code Coverage are Missing when Submit Code Earlier than Setting ‘sonar.leak.period=BASELINE’

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarqube version : 6.7 (build 33306)
    scanner: 3.4.0.905
    jacoco: 0.7.9
  • what are you trying to achieve
    We got a branch named CHG** which will merge to develop branch only if the new code coverage is more then 80%. (new code is in the CHG branch, develop branch is baseline)
    My steps:
    -all code are committed
    -git checkout develop
    -mvn -T 4 clean org.jacoco:jacoco-maven-plugin:0.7.9:prepare-agent install -Dmaven.test.failure.ignore=true
    -mvn sonar:sonar -Dsonar.projectVersion=BASELINE
    //no code check-in anymore
    -git checkout CHG**
    -mvn -T 4 clean org.jacoco:jacoco-maven-plugin:0.7.9:prepare-agent install -Dmaven.test.failure.ignore=true
    -mvn sonar:sonar -Dsonar.leak.period=BASELINE

The new code coverage will not display on dashboard, but at the code page the new code are exist.

But if after set baseline operation, check-in some code to CHG branch and:
-git checkout CHG**
-mvn -T 4 clean org.jacoco:jacoco-maven-plugin:0.7.9:prepare-agent install -Dmaven.test.failure.ignore=true
-mvn sonar:sonar -Dsonar.leak.period=BASELINE
the new code coverage will be shown.

I am not sure the new code detection method whether depends on the code check-in time that earlier or later than set baseline. but can you fellows can fix my issue?
(ps. I tried to set baseline project date earlier than the first commit code time, new code will be shown)

Hi,

A lot of work has been done on the “Clean as You Code” (new name of leak period paradigm) since 6.7.
I highly recommend you to upgrade to latest LTS 7.9.2 before doing anything else.

Regards

Hi Julien, thanks for replying. I wonder how sonar detects(version 6.7 or 7.9.2) the new code.
Is according to the time of code committed?

The detection of new code depends if you’re using a SCM or not, if you’re in a pull request or in a maintenance branches.

Still don’t get it. I’m using SCM and not in pull request. If I don’t use SCM, I’ll not able to find the blame of the new code. Can you elaborate on the rules for detecting new code~~~

This question is being pushed to 2020