【问题标题】:Why should we have to build the project first before executing the SonarQube code analysis in Azure DevOps?为什么我们必须在 Azure DevOps 中执行 SonarQube 代码分析之前先构建项目?
【发布时间】:2021-06-17 17:18:41
【问题描述】:

我只是想知道为什么我们必须在 Azure DevOps 中执行 SonarQube 代码分析之前先构建 (MSBuild) 项目? 如果我们不先构建项目,它会抛出类似

的错误
Post-processing started.
##[error]11:17:23.752  The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:
  1. The project has not been built - the project must be built in between the begin and end ste

这对于集成 SQ 是强制性的吗?有没有办法绕过这个,我的意思是我只想运行代码分析。

【问题讨论】:

    标签: sonarqube


    【解决方案1】:

    除了David M. Karr 提出的观点之外,在 C# 和 VB.NET 的特定情况下,Sonar 分析规则被实现为Roslyn 分析器,这意味着它们由编译器作为构建的一部分执行.无需构建,无需分析。

    SonarCloud 有一个名为 AutoScan 的功能,它为某些语言提供免构建分析,但目前不支持 C#。

    【讨论】:

      【解决方案2】:

      SonarQube 不仅仅对源代码进行静态分析。它需要一些构建工件来进行完整的分析。

      例如,SonarQube 无法在没有运行单元测试生成的数据文件的情况下报告单元测试覆盖率。显然,不编译代码就无法运行单元测试。

      一些语言分析工具还需要编译文件,作为源代码文件的补充或替代。

      【讨论】:

        猜你喜欢
        • 2013-09-21
        • 1970-01-01
        • 2021-01-09
        • 2019-11-14
        • 1970-01-01
        • 2023-04-05
        • 1970-01-01
        • 2020-05-10
        • 2015-05-16
        相关资源
        最近更新 更多