首页 > 解决方案 > 如何修复以下警告:`WARN: The resource for '' is not found, 无法深入了解此测试的详细信息。`

问题描述

我的删节sonar-project.properties文件如下:

# Sources
sonar.sources=felix
sonar.sources.inclusions=**/**.py
sonar.exclusions=**/test_*.py,**/**.pyc,felix/utils/*,**/*.iml

# Linter
sonar.python.pylint=/usr/local/bin/pylint
sonar.python.pylint_config=.pylintrc
sonar.python.pylint.reportPath=pylint-report.txt

# Coverage / Unit Tests
sonar.tests=./tests
sonar.test.inclusions=**/test_**.py
sonar.python.xunit.skipDetails=false
#DEFAULT VALUES: sonar.python.xunit.reportPath=xunit-reports/xunit-result-*.xml
#DEFAULT VALUES: sonar.python.coverage.reportPath=coverage-reports/*coverage-*.xml

删减的源代码树是这样的:

├── felix
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-35.pyc
│   │   ├── process.cpython-35.pyc
│   │   └── spark.cpython-35.pyc
│   ├── felix.iml
│   ├── process.py
│   ├── spark.py
│   └── utils
│       └── utils.py
├── requirements.txt
├── setup.py
├── sonar-project.properties
├── tests
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-35.pyc
│   │   └── test_process.cpython-35-PYTEST.pyc
│   ├── cia-spark.iml
│   ├── data
│   └── test_process.py
└── tox.ini

但是,当我运行时,我收到以下警告sonar-scannerWARN: The resource for '' is not found, drilling down to the details of this test won't be possible

请有人告诉我为什么我会收到此警告以及如何摆脱/修复它?谢谢。

标签: python-3.xsonarqubesonarqube-scan

解决方案


我收到此警告是因为我从分析中排除了测试文件。我看到,在您的属性中,您也排除了您的测试:

sonar.exclusions=**/test_*.py,**/**.pyc,felix/utils/*,**/*.iml

这将阻止声纳计算测试数量及其通过/失败状态,如此处的开源所示


推荐阅读