Could not perform sonarcloud scan for new folders in repository

We are trying to integrate Sonarcloud scan for every pull request created in Bitbucket repository. We have used ‘Bitbucket pull request builder’ as a part of this process and eventually landed up with a result.

The parameters of ‘Execute sonarqube scannner’ in Jenkins is something similar to :

sonar.host.url=https://sonarcloud.io
sonar.organization=****
sonar.projectName=*****
sonar.projectVersion=1.0
sonar.projectKey=****
sonar.pullrequest.branch=master
sonar.sources=A/B/test.java,A/C/test1.java,A/D/test2.java
sonar.java.binaries=***
sonar.exclusions=
sonar.pullrequest.key=5

Whenever we are creating a Pull request in A/B/* or A/C/* folders, the sonarcloud scan is occurring for that PR without any errors. But when we create a pull request in master by creating a new folder and a file (Ex: A/E/x.java) , the sonarcloud scan is failing saying that:

ERROR: Error during SonarQube Scanner execution
ERROR: The folder ‘A/E/’ does not exist for ‘***’

Which means that the folder A/E is not there in the existing workspace in Jenkins… How can i even scan the newly created folders in the PR ? Any suggestions would be helpful

Thank you,

Hi @Vishal3,

I would expect the sonar.sources parameter to list path to directories, not source files, as per the documentation pages here

Regards,
Alex

Hi @AlxO,

You mean mentioning sonar.source to A/* ?

Hi @AlxO,

Even though i have mentioned sonar.source=A/B,A/C , we are facing with the same error while analyzing the new pull request ( ERROR: Error during SonarQube Scanner execution
ERROR: The folder ‘A/E/’ does not exist for ‘***’ ) as the A/E is created in Master branch pull request but not on master branch and also in the Jenkins work space.