如何配置 SonarLint 命令行分析其他语言?

How to configure SonarLint Command Line analyze other language?

作为主题,例如 Groovy 个文件。

我在 my-groovy/src/main/java/com/mygroovy/example 下创建了一个 groovy 文件,它包含一个声纳问题 "Unused Variable",可以被声纳运行器检测到。

运行 sonarlint下my-groovy成功,但报错。它说没问题...

my-groovy mac$ sonarlint --src '**/src/main/**'
INFO: Java 1.8.0_73 Oracle Corporation (64-bit)
INFO: Mac OS X 10.11.5 x86_64
INFO: Connected mode (org.mysonar:groovy)
INFO: Using storage for server 'org.mysonar' (last update 9/16/16 4:46 PM)
INFO: Index files
INFO: 6 files indexed
INFO: 4 source files to be analyzed
INFO: 4/4 source files have been analyzed
INFO: 

-------------  SonarLint Report  -------------

  No issues to display (6 files analyzed)

-------------------------------------------


INFO: SonarLint HTML Report generated: /Users/mac/Desktop/source/my-groovy/.sonarlint/sonarlint-report.html
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.855s
INFO: Final Memory: 6M/256M
INFO: ------------------------------------------------------------------------

我的sonarlint.json是

{
"serverId": "mysonar",
"projectKey":"org.mysonar:groovy"
}

我的global.json是

{
  servers: [
    {
      "id": "mysonar",
      "url": "http://sonarqube.mysonar.io:80",
      "login":"aaa",
      "password":"aaa"
    }
  ]
}

SonarLint 尚不支持 Groovy 分析器,这就是您遇到这种意外行为的原因。