How to calculate coverage on new code even before pushing code to repository?

Hi,
I use SonarQube 7.5 (Community Edition) and Sonar-Scanner (4.2) and SonarLint for local analysis.
This helps me to identify new issues brfore pushing my code to SCM. Similarly, I am trying to get JUnit coverage on my local code (new_code) which is not pushed to SCM. The process I followed is

  1. Run build, jacoco, sonar-scanner with version number 1 and baselined it.
  2. Make my changes locally and ran sonar-scanner with version number 2.

But SonarQube doesn’t show coverage under new-code section. I can see the coverage changed (reduced) if go to the specific file, but sonarqube is unable to detect the coverage on new code.

Is there a way we can get coverage on new code using SonarQube platform, before pushing code to SCM systems? Any help would be greatly appreciated.

I guess it detects new code by your code committed time. You can try to close the SCM func with “-Dsonar.scm.disabled=true”
(I have a same question, you can refer to my question)

Turning off SCM didn’t work. I have already tried it.

Hi,

Welcome to the community!

I see that you’re on 7.5. Detection of what’s new has been improved since then. Please upgrade to 8.1, try again, and get back to us.

 
Ann

Java 11 :cold_sweat:

Did you able to solve the problem