Wrong number of lines showing in Coverage section on PRs

Hi,

Disabling the SCM Sensor is not going to move you closer toward a solution.

Again:

You need to figure out why the SCM data is missing, not disable the sensor.

 
HTH,
Ann

Ok, Thanks
Will update you soon on this.

Hi,
This is our project root directory where sonar cloud analyses the code.
image

Should sonar cloud analyze the code in this directory or somewhere else?

Hi,

Analysis should start from the directory you’ve shown, the one with the .git subdirectory.

 
Ann

Ok thanks,
so may you elaborate your question (how do you obtain the files for analysis?) you asked above in the chat, because I didn’t understand what are you exactly asking for.

Hi,

I was asking: do you check them out in the analysis directory? Copy them from another directory? Something else?

 
Ann

Yes, code analysis is working in the project root directory where .git folder exists and .sonarqube folder is auto generated. We are not copying anything from anywhere.

And the other issue we observed that the Quality Gate from dev branch had been passed but when we created a separate branch from dev branch (in which Quality Gate already passed) the Quality Gate from new branch has been failed inspite of the Quality Gate had been passed in the dev branch and it is showing 5 new lines to cover from dev branch and 21k new lines to cover from new branch.

Thanks

Hi,

Okay, so we’re back to this:

 
Ann

Hi,

We have compared the sonar-project.properties file of different projects and we have also found the similar issue in an another project and we found that correct SCM data path is missing in sonar-project.properties file. I am attaching the snapshots of both files with correct and wrong SCM data path.

Snapshot with Correct SCM data path

Snapshot with Wrong SCM data path

You have any idea why it is happening because this sonar-project.properties file is auto generated.

Thanks

Hi,

I’m not sure which property you think points to the “SCM data path”, but that’s not what either of those properties is for. And I have no idea about your property file generation.

Maybe just start with crafting one by hand and seeing if you can get that to work?

 
Ann

Hi,

I am talking about “sonar.projectBaseDir” in the given snapshot. When we wrote “sonar.scm.provider=git” in our jenkinsfile in sonar cloud analysis stage so we got this error,

Hi,

Again, analysis is expecting to run in the directory in which you checked out the project. I’m pretty sure you didn’t check out into C:\jenkins\workspace but into a subdirectory of that directory. You should take a look at whatever’s generating these files.

 
Ann

Hi Ann,

The issue has been resolved and thank you so much for providing the much-needed assistance we needed during that hectic period. The issue was SCM missing you have mentioned and it was happening due to the file that is created by sonar cloud on the time of analysis and the file has incorrect project root directory path, so we sorted out this by passing correct project root directory path through our jenkinsfile.

Thanks

1 Like