我正在尝试使用sonarqube分析我想每天运行的azure devops git存储库中的特定文件(filename.ts)。
到目前为止,我已经建立了:
A sonarqube project and generated project token in our sonarqube saas.
Created a CD release pipeline in Azure DevOps including the predefined sonarqube tasks:
* prepare analysis on sonarqube (unclear to me how I configure this)
* run code analysis (looks as if this doesn't require configuration)
* publish quality gate (same belief here that it doesn't require configuration)
Identified the repository where the file exists in the azure repo.
I have also discovered the artifact name that the repo's CI pipeline generates.
Found a preconfigured sonarqube service connection in Azure DevOps.
我现在挠头的地方是确定以下几点:
a. How to tell my CD pipeline where the file is in the azure repo. Should I point it to the file in the Repo? Or should i take it from the CI artifact?
b. Would the sonarqube project require further configuration so to see the file?
我觉得这个谜题还有更多内容。有人可以指出正确的道路吗,请包括我可能未曾想到的其他内容?
首先,您需要检查预配置的声纳服务连接是否指向您的声纳主机。
转到Project settings
azure devops-> Service connections
->选择预先配置的sonarqube service connection
->单击Edit
->检查Server Url
指向您的声纳主机网址的位置。
如果预配置的声纳服务连接指向其他声纳主机。您需要为您的声纳主机创建一个新的声纳服务连接。
分析特定文件:
您可以将sonar.inclusions
属性设置为仅分析特定文件。参见下图。请查看文档缩小焦点以获取更多信息。
您可以在发布管道的“准备分析配置”任务sonar.inclusions
的Additional Properties
字段中配置属性。
或者,您也可以sonar.inclusions
在SonarQube项目UI中设置属性。
要使用排除项仅分析sonar.sources中文件的指定子集,请转至“项目设置”>“常规设置”>“分析范围”>“文件”。
- 源文件包含
- 测试文件包含
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句