I am struggling setting up SONAR Cloud in my project. I have the SONAR Cloud subscription.
I have many problems using it.
Problems:
When I push code in any branch - SONAR starts the merge request analysis and run successfully but at the end dashboard is shown all ZEROs. Please check the screen shot.
If I specify the branch name in the sonar project property file then it is able to analyse and show some results but then - It is not handy to hard code branch name in the property file.
Once branch analysis is done - (after specifying a specific branch name in property file) - I see Test Coverage is Zero while there are so many Unit tests are written.
Following is setup in Sonar Project propery file:
# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=Monorepo-poc
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=packages/frontoffice/src
sonar.tests=packages/frontoffice/tests/unit
Log has got many confidential information. Let me know how can I arrange this?
@Claire_Villard
Note: In the first screenshot, if you see every KPI is zero except one - Code duplication. That is always calculated. How is that possible.
Thanks for the response. For any PR requests, I am able to see the analysis on all the lines of changes done.
But we do not see analysis of overall branch. How can we achieve that? We are expecting something like this - where I can see analysis of a specific PR and also overall analysis of that branch. Something like this: We get this when we are running Sonar analysis in my local in docker:
About 1. and 3.
Overall analysis does not exist for Pull Requests. All code updated in a Pull Request is considered as new code. SonarCloud philosophy is to clean the code while coding, meaning all the new code should be clean, but fixing all the code that already works would be a difficult work. You can find more information on this on that page.
To have overall analysis on a given branch, you should not analyze it as a Pull Request but as a Long living branch. Here is the documentation to configure the Long living branch pattern.
Have you read the New code definition dedicated page? To help you further on that configuration, I would need to know the kind of release management to have on your project: version based, continuous delivery, other…