In previous versions of SonarCloud and SonarQube you could see the progress of PRs and branches and what problems they’ve “fixed”. Somehow this is no longer visible on a few projects I’m working on. For example I have a short-lived branch fixing a java:S2245
violation in main
in a couple of classes. However this information is nowhere to be found in the dashboard:
I was expecting the branch summary page to look more like the screenshot below with details of how many bugs/vulnerabilities/code coverage were fixed or introduced.
Here’s our configuration:
// build.gradle.kts
sonarqube {
properties {
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.projectKey", "XYZ")
property("sonar.organization", "XYZ")
property("sonar.token", project.findProperty("sonar.token") as? String ?:
System.getenv("SONAR_PROJECT_TOKEN") ?:
providers.gradleProperty("sonar.token").orElse(""))
property("sonar.sourceEncoding", "UTF-8")
property("sonar.java.source", java.targetCompatibility)
property("sonar.java.target", java.targetCompatibility)
property("sonar.language", "java")
property("sonar.java.coveragePlugin", "jacoco")
property("sonar.coverage.jacoco.xmlReportPaths", "**/build/reports/jacoco/test/jacocoTestReport.xml")
property("sonar.junit.reportsPath", "**/build/reports/tests/test/xml/**")
property("sonar.dynamicAnalysis", "reuse")
property("sonar.exclusions", arrayListOf("src/main/test/**/*"))
val gitRef = System.getenv("GITHUB_REF") // refs/pull/5/merge
val gitRefName = System.getenv("GITHUB_REF_NAME") // 5/merge
val gitSourceRef = System.getenv("GITHUB_HEAD_REF") // feature-branch-name
val gitTargetRef = System.getenv("GITHUB_BASE_REF") // main
val isPullRequest = gitRef?.startsWith("refs/pull") ?: false
if(isPullRequest)
{
// https://docs.sonarsource.com/sonarqube/9.8/analyzing-source-code/pull-request-analysis/
property("sonar.pullrequest.key", gitRefName.substringBefore("/merge"))
property("sonar.pullrequest.branch", gitSourceRef)
property("sonar.pullrequest.base", gitTargetRef)
}
else
{
// Regular Branch Setup
val branch = gitRefName ?: ("local-developer-scan-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HHmmss")))
property("sonar.branch.name", branch)
property("sonar.branch.target", "main")
}
}
}
Is there an additional property or dashboard configuration?
What am I missing here?