sonarqube无法读取ruby on rails项目的覆盖率报告文件

ehxuflar  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(226)

我的项目正在生成coverage/.resultset.json,但coverage没有显示在sonar中。我正在使用simplecov 0.21.2,出现以下错误:

ERROR: Cannot read coverage report file, 
expecting standard SimpleCov JSON formatter output: 'coverage/.resultset.json'
java.lang.ClassCastException: class org.sonarsource.analyzer.commons.internal.json.simple.JSONObject cannot be cast to class org.sonarsource.analyzer.commons.internal.json.simple.JSONArray (org.sonarsource.analyzer.commons.internal.json.simple.JSONObject and org.sonarsource.analyzer.commons.internal.json.simple.JSONArray are in unnamed module of loader org.sonar.classloader.ClassRealm

simplecov文件具有以下设置:

require 'simplecov'

# features/support/env.rb

require 'simplecov'

# .simplecov

SimpleCov.start 'rails' do
  SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
    SimpleCov::Formatter::HTMLFormatter,
    SimpleCov::Formatter::JSONFormatter
  ])

SimpleCov.start do
  enable_coverage :branch
end

  SimpleCov.minimum_coverage 70
end

sonar-project.properties:

sonar.projectKey=project
sonar.host.url=host

# --- optional properties ---

# authentication token to connect to sonar

sonar.login=token

# Path is relative to the sonar-project.properties file. Defaults to .

sonar.sources=.

sonar.ruby.coverage.reportPaths=coverage/.resultset.json

# Encoding of the source code. Default is default system encoding

sonar.sourceEncoding=UTF-8

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题