【问题标题】:Android lint shows up no issues in SonarqubeAndroid lint 在 Sonarqube 中没有显示任何问题
【发布时间】:2017-08-25 11:13:04
【问题描述】:

我已将我的项目设置为与 Sonarqube 一起使用。我使用 PMD 和 Checkstyle 运行测试,所有测试都成功登录到 Sonarqube 控制台。但昨天我决定将 Android lint 规则也添加到我的质量配置文件中。我已在新配置文件中激活所有 Lint 规则并运行该项目。现在,当我运行该项目时,它没有显示此配置文件的任何错误或问题。当我在本地运行 lint 时,我遇到了大约 400 个问题。我可能会错过什么?

我在我的服务器上使用 Gradle 和 Sonarqube 6.2 中的 Sonarqube 插件。我的Sonarqube配置如下

apply plugin: "org.sonarqube"

sonarqube {
//noinspection GroovyAssignabilityCheck
    properties {
//noinspection GroovyAssignabilityCheck
        property "sonar.projectName", "MyProject"
//noinspection GroovyAssignabilityCheck
        property "sonar.projectKey", "Testapplication"
//noinspection GroovyAssignabilityCheck
        property "sonar.projectVersion", "1.0"
//noinspection GroovyAssignabilityCheck
        property "sonar.analysis.mode", "publish"
//noinspection GroovyAssignabilityCheck
        property "sonar.language", "java"
//noinspection GroovyAssignabilityCheck
        property "sonar.sources", "src/main/"
//noinspection GroovyAssignabilityCheck
        property "sonar.profile", "FindBugs"
//noinspection GroovyAssignabilityCheck
        property "sonar.host.url", "http://192.168.21.33:9000"
//noinspection GroovyAssignabilityCheck
        property "sonar.login", "admin"
//noinspection GroovyAssignabilityCheck
        property "sonar.password", "admin"
        property "sonar.exclusions","es.miguelprietos.testapplication/R.java"
        property "sonar.android.lint.report", "build/outputs/lint-results.xml"
        property "sonar.binaries", "build/intermediates/classes/debug"
        property "sonar.java.binaries", "build/intermediates/classes/debug"


    }
}

我使用以下命令来运行我的声纳任务(无参数)。

 ./gradlew sonarqube

我的 Gradle 中配置的 Lint 选项如下

   lintOptions {
        // set to true to turn off analysis progress reporting by lint
        quiet true
        // if true, stop the gradle build if errors are found
        abortOnError false
        // if true, only report errors
        ignoreWarnings true
    }

【问题讨论】:

标签: android gradle sonarqube sonarlint


【解决方案1】:

我认为“./gradlew lint”是您正在寻找的。 如此处所述,它将生成缺失的 XML 报告。 注意,它可以为每个构建变体生成报告(Debug 默认会生成 build/outputs/lint-results-debug.xml)。因此,您可以调用 lintDebug、lintRelease...,具体取决于您的构建变体。

并根据生成的文件更改您的报告文件名。

【讨论】:

    【解决方案2】:

    尽量不要忽略警告:

    lintOptions {
        // set to true to turn off analysis progress reporting by lint
        quiet true
        // if true, stop the gradle build if errors are found
        abortOnError false
        // do not ignore warnings
        warningsAsErrors true
    }
    

    【讨论】:

      猜你喜欢
      • 2016-12-13
      • 2017-02-24
      • 1970-01-01
      • 1970-01-01
      • 2013-10-14
      • 2023-04-09
      • 2015-10-31
      • 1970-01-01
      • 2017-10-22
      相关资源
      最近更新 更多