Hi, I am new to SonarCloud. I have configured SonarCloud in my VSTS pipeline. Having triggered the build and run the tests, it creates the link saying Detailed SonarCloud report but when I click to open it, it says The main branch has no lines of code. Not sure why. I tried a few options but still cannot figure out. Please could someone help.
Did you run the build / analysis on the default branch of your repo ? Where it is located ? Azure Git, GitHub, Bitbucket Cloud ?
Hi @mickaelcaro, I’m a colleague of Kumar who has just been trying to locate track down the same issue with a similar repo. In the case I have the analysis is running from an Azure DevOps Git repo, the build is also running in Azure DevOps, and the result is also ‘The main branch has no code’. When I look at the Code tab I can see the files and their contents, but next to each one it says a ‘-’ character instead of the number of lines of code, and the other measures are zeros.
Separate to this I have managed to get SonarCloud analysis working with a separate repository via a near identical setup so I’m not clear what the issue might be. Do you have any suggestions for other things I can check?
Hi, I am facing same issue here, with the same error " The main branch has no lines of code."…
Back a few months ago, I was using “SonarCloud task” on AzureDevOps and it was working great.
Then it has stopped working and today I deleted the project, to see if e.g. an older “sonarqube task” would be still be working. Alas without success.
The pipeline can be found here https://github.com/dmpe/MeetupToRTM/blob/master/azure-pipelines.yml and project here https://sonarcloud.io/dashboard?id=dmpe_MeetupToRTM
Btw. I was using MSBuild configuration and that has not worked.
I have now switched to CLI
scannerMode: 'CLI' and it seems to have started sending proper data to SonarCloud again (showing bugs, issues, etc.), though only the dashboard…My project has many bugs and numbers for these are not shown here at all (as if C# is not being scanned)…
Any ideas ? Thanks.
Given your pipeline, i’m not quite sure about the additional property you set : sonar.branch.target . Using this setting is required only for short-lived branch, or initialize a branch and sync issues with another branch.
As you are analyzing master directly, could you try an analysis without this setting and let us know ?