首页 > 解决方案 > SonarQube 在 detekt gradle 插件中是否有 gradle 设置以在远程主机上而不是在文件中生成报告

问题描述

当我使用 sonarqube 插件时,我无法在远程主机上生成关于使用我的特定分支的报告,因为最新版本不支持它并且不推荐使用 branch.name

因此,当我使用 detekt 插件时,它会在本地文件中生成报告,而不是在远程主机上。如何提供 gradle 设置以在远程主机上生成 html 报告就像我们使用 sonarqube 插件时使用属性 sonar.host.url 生成一样

我的 build.gradle 看起来像

 failFast = true // fail build on any finding
 buildUponDefaultConfig = true // preconfigure defaults
 config = files("$projectDir/config/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
 baseline = file("$projectDir/config/baseline.xml") // a way of suppressing issues before introducing detekt

 reports {
     html.enabled = true // observe findings in your browser with structure and code snippets
     xml.enabled = true // checkstyle like format mainly for integrations like Jenkins
     txt.enabled = true // similar to the console output, contains issue signature to manually edit baseline files
    html.destination =  "Remote host url"

 }

}```

 ```plugin {
  id("io.gitlab.arturbosch.detekt") version "1.5.1"
   id("org.sonarqube") version 2.7
 }```




标签: gradlekotlinsonarqubedetekt

解决方案


嗨,我的代码适用于 id("org.sonarqube") 版本 2.7 我不需要 detekt 插件

我们发现未启用 sonarqube kotlin,这就是为什么当我们尝试使用任何其他分支运行它时,它总是说 master 分支为空,在服务器启用 kotlin 支持后,只需添加 sonarqube 服务器主机,它就可以用于任何分支。


推荐阅读