Search code examples
sonarlint

How to configure SonarLint Command Line analyze other language?


As subject, for example Groovy files.

I created a groovy file under my-groovy/src/main/java/com/mygroovy/example, it contains an sonar issue "Unused Variable", which can be detected by sonar runner.

Run sonarlint under my-groovy success, but the reports is incorrect. It says no issue...

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: ------------------------------------------------------------------------

My sonarlint.json is

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

My global.json is

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

Solution

  • The Groovy analyzer is not yet supported by SonarLint and that's why you're getting this unexpected behavior.