未找到SonarQube Lcov.info

时间:2017-09-06 11:28:37

标签: sonarqube

我遇到了SonarQube实例的问题。我们从istanbul打印出lcov信息,但是sonarqube无法找到lcov信息来生成代码覆盖。 project.properties文件现在已经删除了lcov信息:

sonar.projectKey=*****
sonar.projectName=*****
sonar.projectVersion=1.0
sonar.host.url=***********
sonar.sources=.
sonar.projectBaseDir=./app
sonar.exclusions=**/bower_components/**/*.*,**/vendor/**/*.*
sonar.language=js
sonar.sourceEncoding=UTF-8
sonar.verbose=true
sonar.log.level=DEBUG

但是来自sonarqube的日志说它还在寻找它:

11:19:12.551 INFO: 177/225 files analyzed, current file: /app/app/target/schema/list/target-schema-list-controller_test.js
11:19:15.103 INFO: Unit Test Coverage Sensor is started
11:19:15.103 INFO: 225/225 source files have been analyzed
11:19:15.104 WARN: No coverage information will be saved because LCOV file cannot be found.
11:19:15.104 WARN: Provided LCOV file path: coverage-app/html/lcov.info. Seek file with path: /app/app/coverage-app/html/lcov.info
11:19:15.105 WARN: No coverage information will be saved because all LCOV files cannot be found.
11:19:15.105 INFO: Integration Test Coverage Sensor is started
11:19:15.105 WARN: No coverage information will be saved because LCOV file cannot be found.
11:19:15.106 WARN: Provided LCOV file path: coverage-server/lcov.info. Seek file with path: /app/app/coverage-server/lcov.info
11:19:15.106 WARN: No coverage information will be saved because all LCOV files cannot be found.
11:19:15.106 INFO: Overall Coverage Sensor is started
11:19:15.106 WARN: No coverage information will be saved because LCOV file cannot be found.
11:19:15.106 WARN: Provided LCOV file path: coverage-app/html/lcov.info. Seek file with path: /app/app/coverage-app/html/lcov.info
11:19:15.106 WARN: No coverage information will be saved because LCOV file cannot be found.
11:19:15.107 WARN: Provided LCOV file path: coverage-server/lcov.info. Seek file with path: /app/app/coverage-server/lcov.info
11:19:15.107 WARN: No coverage information will be saved because all LCOV files cannot be found.

如果它没有从我运行sonarqube程序的项目属性中获取位置,那么从哪里可以读取配置?

2 个答案:

答案 0 :(得分:2)

您应该在sonar-project.properties文件中添加此设置:

sonar.javascript.lcov.reportPaths=path/to/coverage/lcov.info

此外,在某些CI工具(在我的情况下是Gitlab CI)中,您可能必须指定lcov.info文件是“工件”,因此声纳扫描器作业不会删除它

答案 1 :(得分:0)

记住coverage文件夹中的项目文件夹

img