0

我的项目正在生成 coverage/.resultset.json 但覆盖范围未显示在 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

声纳-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
4

0 回答 0