我试图为一个python项目建立一个gitlab ci管道,但是sonarqube客户端有一些问题,它无法解析覆盖率.xml文件
我得到的错误是:
INFO: Python test coverage
INFO: Parsing report '/builds/core-tech/tools/nlu/mix-nlu-middleware/server/tests/cov.xml'
WARN: Invalid directory path in 'source' element: /bolt-webserver/bolt
WARN: Invalid directory path in 'source' element: /bolt-webserver/tests
ERROR: Cannot resolve the file path 'base.py' of the coverage report, the file does not exist in all <source>.
ERROR: Cannot resolve 404 file paths, ignoring coverage measures for those files
INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=74ms
INFO: Sensor PythonXUnitSensor [python]
INFO: Sensor PythonXUnitSensor [python] (done) | time=20ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
报道文件(cov.xml文件)从这个开始:
^{pr2}$声纳是这样叫的:
- sonar-scanner -Dsonar.projectKey=mix-nlu-middleware -Dsonar.sources=./server -Dsonar.host.url=$SONAR_SERVER_HOST -Dsonar.login=$SONAR_LOGIN -Dsonar.python.coverage.reportPaths=server/tests/cov.xml -Dsonar.junit.reportPaths=server/tests/junit-report.xml
项目树如下所示:
.
+-- CONTRIBUTING.md
+-- gen_version.sh
+-- package-lock.json
+-- README.md
+-- scripts
│ +-- .....
+-- server
│ +-- alembic.ini
│ +-- bolt
│ │ +-- .....
│ +-- Bolt.egg-info
│ │ +-- .....
│ +-- conf
│ │ +-- .....
│ +-- dev-requirements.txt
│ +-- Dockerfile
│ +-- Dockerfile-dev
│ +-- http.log
│ +-- MANIFEST.in
│ +-- pytest.ini
│ +-- requirements.txt
│ +-- scripts
│ │ +-- .....
│ +-- sdks
│ │ +-- ....
│ +-- server.log
│ +-- setup.py
│ +-- templates
│ │ +-- .....
│ +-- tests
│ │ +-- .....
│ \-- version.properties
\-- test.txt
你知道我做错什么了吗?在
我仍然尝试在项目的根目录下创建文件夹。在
的基准.py'文件和其他在转换.xml位于“/builds/core-tech/tools/nlu/mix-nlu middleware/server/tests”下
好吧,问题似乎来自cov.xml文件内容。sonarqube似乎无法仅根据文件名来定位测试文件:filename=“基准.py" 为了解决这个问题,我必须更新cov.xml文件使文件名字段包含完整的文件路径。文件名=“/基准.py““
相关问题 更多 >
编程相关推荐