如何修复以下警告:`警告:找不到''的资源,深入研究此测试的详细信息是不可能的。

问题描述 投票:1回答:2

我删节的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.x sonarqube sonarqube-scan
2个回答
2
投票

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

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

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


0
投票

事实证明,将Pylint集成到Pytest调用中。父Pytest调用生成了一个单元测试报告,该报告具有空的类名,用于Pylint提出的其他“空”测试。 SonarQube警告那些空的类名。我最终删除了Pylint Pytest集成,只是将Pylint作为与Pytest分开的步骤运行。

© www.soinside.com 2019 - 2024. All rights reserved.