- ALM used - Bitbucket Cloud
- CI system used - Bitbucket Cloud
- Scanner command used when applicable:
- pipe: sonarsource/sonarcloud-scan:1.2.0
- pipe: sonarsource/sonarcloud-quality-gate:0.1.4
- Languages of the repository - monorepo but these files are typescript
- Error observed:
The main branch has no lines of code.
Quality gate has not been computed for project.
- Steps to reproduce: Running any scan pipeline, it finishes successfully but when I click the task report I get the branch has no code, running the quality gate pipe fails saying the quality gate has not been computed.
Example task id:
Hello @Matt12, welcome to the community forum and apologies for the late reply.
The error message
the main branch has no lines of code indicates that your default branch hasn’t been analyzed yet. Could it be that you currently are only analyzing PRs and non default branches?
It would also be good to check that the default branch on SonarCloud is the same as on Bitbucket Cloud. You can do this by navigating to you
project on SonarCloud and Administration > Branches & Pull Request. You can rename the default branch on SonarCloud to match your default branch on Bitbucket Cloud.
Same Error “The main branch has no lines of code.” when I scan my xcode project with Fastlane. Please help and if possible provide a well define tutorial how we scan iOS code with sonar through Fastlane.
Has anybody ever fixed this? I am having the same problem with GitLab. I’ve double checked my .gitlab file and it’s checking all the branches including my default branch and still it says “The main branch has no lines of code.” but when I define my own quality gate rules it will fail because of the errors I have purposely implemented but it still won’t give me any results on the overview tab. It just continues to say “The main branch has no lines of code.”
Same issue in gitlab, I see the code, but still says ‘The main branch has no lines of code’. Any help?