4

IntelliJ 的 Sonarlint 插件会分析我们的 Java 代码,但不会分析同一项目中的 Groovy 代码。

我们有一个 Grails 项目,可以在命令行上使用 sonar-runner。当我安装 IntelliJ IDEA Sonarlint 插件时,该插件似乎没有从我们的命令行配置中获取设置,并且它没有像编辑器中的 Java 文件那样显示问题的警告突出显示。

我们的项目使用“代码覆盖率”Grails 插件生成 XML 覆盖率报告,然后声纳运行器(命令行工具)提取指标。在sonar-project.properties中,我们设置:

# Project key within sonar
sonar.projectKey=com.mycompany:myapp
sonar.projectName=My Grails Project
sonar.projectVersion=1.0

# Source directories to analyze
sonar.sources=src/groovy, grails-app/domain, grails-app/services, grails-app/controllers, grails-app/utils, grails-app/taglib, grails-app/views

# Set language for the project to be Groovy
sonar.language=grvy

# Path to the Cobertura XML report
sonar.grvy.coveragePlugin=cobertura
sonar.groovy.cobertura.reportPath=target/test-reports/cobertura/coverage.xml

sonar.jdbc.username=...
sonar.jdbc.password=...

sonar.host.url=http://sonar.mycompany.com

sonar.jdbc.url=...
sonar.jdbc.driverClassName=...

属性文件有 JDBC 设置、覆盖报告路径等。

4

1 回答 1

3

SonarLint is a different product than SonarQube (even if there are some links). For example SonarLint doesn't know what is sonar-project.properties. The purpose is to integrate with IntelliJ, not with some external configuration.

Regarding Groovy support, this is not planned since we don't have any Groovy analyzer (the SonarQube plugin for Groovy is simply reusing codenarc reports AFAIK). If you want to run Codenarc in IntelliJ, there is already a dedicated plugin for that.

于 2016-06-30T09:31:43.553 回答