Template for a good new topic, formatted with Markdown:
ALM used: GitHub
CI system used: Jenkins
Scanner command used when applicable: ./gradlew --stacktrace sonarqube ${sonarParams}
Languages of the repository: Java, Kotlin
Error observed: No error
Hi!
We are finishing our integration in some of our repositories. During the integration, we have noticed we do specify information as Sonar parameters, to help with PR decoration. We do it in this way:
Then passing these params to our Gradle task, to perform the project scan. These parameters (except the revision), seem pretty standard. We were wondering if it is actually possible to not specify them and let the scanner infer them automatically.
If your project is bound to GitHub, you should be able to perform successful analysis without specifying -Dsonar.pull.request.branch and -Dsonar.pull.request.base. You can find more information here: https://sonarcloud.io/documentation/analysis/pull-request#analysis-parameters. Let me know if you need any more help.
Thanks Marcin. I’ve notices this solution only works when you have an ALM selected from the beginning when you configured the project. In our case, one of our repositories was not configured in that fashion from the beginning, it was a manual process. Is there any way we can re-link the project to its ALM? It currently works well with the current setup, but I can’t see the Github icon, neither I can remove the “request.branch” parameter.
Yes, you are right, this solution will only work if you have imported the project from the ALM, this will not work when you set up a project manually. There is no way currently to bind manually imported projects to its ALM. If you wish not to use request.branch and request.base parameters you have to import the project again in a recommended way (through “+” -> “Analyze new project” and then import from organization).