Hi, I’m running sonarcloud on monorepo hosted in Github. I run sonar-scanner in Drone CI using the drone plugin. When drone is running on master I call the following command: sonar-scanner -Dsonar.login=$SONAR_TOKEN -Dsonar.host.url=$SONAR_HOST
and when I’m running on PR branch I run the following: sonar-scanner -Dsonar.login=$SONAR_TOKEN -Dsonar.host.url=$SONAR_HOST -Dsonar.pullrequest.key=$DRONE_PULL_REQUEST -Dsonar.pullrequest.branch="$(git branch --show-current)" -Dsonar.pullrequest.base=master
My issue is that every analysis on PR has 0 new lines and contains no new code. In each PR the sonarcloud quality check is properly displayed. What am I doing wrong?
Hi, thank you very much for your answer and suggestions.
Regarding the sources: I’m setting sources and test folders for each of the monorepo’s services using the sonar-project.properties file. The settings usually look like this:
Regarding the git diff: The command you sent when called right before the sonar-scanner returns the expected output. However note that the paths returned are relative to the repo root but sonar-scanner command is called in the service subdirectory.
So I tried running it with the -X switch and it appears that the proper files are processed. I’m seeing lines similar to the following:
11:34:01.602 DEBUG: '<PATH_TO_THE_FILE>' indexed with language 'ts'
Should I look for other information in the -X run output?
Regarding the 0 lines: When I open the sonarcloud PR analysis through the sonarcloud quality check in my PR on github the Code tab is empty and also in the Summary in the top left corner it says 0 New Lines.