问题
I am trying to have SonarQube (6.0) with generic test coverage plugin (1.2) read the coverage report which I created for go language. Coverage report is exactly in the xsd schema that sonar expects. However the analysis with sonar-scanner 2.8 fails with following exception.
java.lang.IllegalStateException: Line 2 of report test-results.xml refers to a file with an unknown language: queue/queue.go
I am passing following in sonar-project.proeprties.
sonar.import_unknown_files=true
sonar.genericcoverage.reportPaths=test-results.xml
Can you provide some suggestion on how to go about it.
回答1:
The basis of any analysis is the code analyzer which declares the language (Go, in this case). Typically analyzers also parse the language, provide metrics for it and offer some rules.
You cannot pull in coverage results for a language unless you first have this piece in place. So it sounds like you're missing a code analyzer for Go.
回答2:
As G. Ann said, you need to make sure you have the Language Parser Plugin installed.
SonarQube 7.x comes with SonarGo or you can use the information in my repo for more detailed info: https://github.com/Talderon/k8s-sonarqube-golang
来源:https://stackoverflow.com/questions/41768293/sonarqube-generic-coverage-sensor-fails-with-with-an-unknown-language-for-go