• <bdo id='cxIIH'></bdo><ul id='cxIIH'></ul>

      <i id='cxIIH'><tr id='cxIIH'><dt id='cxIIH'><q id='cxIIH'><span id='cxIIH'><b id='cxIIH'><form id='cxIIH'><ins id='cxIIH'></ins><ul id='cxIIH'></ul><sub id='cxIIH'></sub></form><legend id='cxIIH'></legend><bdo id='cxIIH'><pre id='cxIIH'><center id='cxIIH'></center></pre></bdo></b><th id='cxIIH'></th></span></q></dt></tr></i><div id='cxIIH'><tfoot id='cxIIH'></tfoot><dl id='cxIIH'><fieldset id='cxIIH'></fieldset></dl></div>
      <tfoot id='cxIIH'></tfoot>

      <small id='cxIIH'></small><noframes id='cxIIH'>

        <legend id='cxIIH'><style id='cxIIH'><dir id='cxIIH'><q id='cxIIH'></q></dir></style></legend>

        如何使 Sonarqube 从覆盖度量中排除 .NET (C#) 项目

        How to make Sonarqube exclude a .NET (C#) project from coverage measures(如何使 Sonarqube 从覆盖度量中排除 .NET (C#) 项目)

          <bdo id='Kcmap'></bdo><ul id='Kcmap'></ul>
          <tfoot id='Kcmap'></tfoot>

          <i id='Kcmap'><tr id='Kcmap'><dt id='Kcmap'><q id='Kcmap'><span id='Kcmap'><b id='Kcmap'><form id='Kcmap'><ins id='Kcmap'></ins><ul id='Kcmap'></ul><sub id='Kcmap'></sub></form><legend id='Kcmap'></legend><bdo id='Kcmap'><pre id='Kcmap'><center id='Kcmap'></center></pre></bdo></b><th id='Kcmap'></th></span></q></dt></tr></i><div id='Kcmap'><tfoot id='Kcmap'></tfoot><dl id='Kcmap'><fieldset id='Kcmap'></fieldset></dl></div>
            • <small id='Kcmap'></small><noframes id='Kcmap'>

                <legend id='Kcmap'><style id='Kcmap'><dir id='Kcmap'><q id='Kcmap'></q></dir></style></legend>
                  <tbody id='Kcmap'></tbody>

                1. 本文介绍了如何使 Sonarqube 从覆盖度量中排除 .NET (C#) 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Sonarqube 允许通过在 sonar.coverage.exclusions 键中添加模式来将单个文件排除在代码覆盖范围之外.这可以通过将它们添加到 UI 甚至 .csproj 文件中(通过指定 SonarQubeSetting 元素)在项目级别上完成.即

                  Sonarqube allows for individual files to be excluded from code coverage by adding patterns in the sonar.coverage.exclusions key. This can be done on a project level by adding them in the UI and even in a .csproj file by specifying a SonarQubeSetting element. I.e.

                  <SonarQubeSetting Include="sonar.coverage.exclusions"><值>**/*.cs</值></SonarQube 设置>

                  但是,这两种方法似乎都不起作用.使用 SonarQube 文档中指定的模式不提供想要的结果.我也知道 SonarQubeExclude MSBuild 属性的存在,但我不想走这条路,因为它会将我的项目排除在所有其他分析之外.

                  However, both of these approaches don't seem to work. Playing with the patterns, as specified in the SonarQube documentation doesn't provide the desired result. I'm also aware of the existence of the SonarQubeExclude MSBuild property, but I don't want to go down that path as it would exclude my project from all other analysis.

                  还有另一种我失踪的可能性吗?还是根本不可能将项目中的所有类都排除在代码覆盖范围之外?

                  Is there another possibility that I'm missing? Or is it simply not possible to exclude all of the classes within a project from code coverage?

                  推荐答案

                  总结上面的答案,也加一点.

                  Summing up the above mentioned answers and also adding one point to it.

                  1. 要从 csproj 中排除 SonarQube 分析中的项目,我们可以通过在该项目的 .csproj 中添加以下代码来实现

                  1. To exclude a project from SonarQube Analysis from csproj we can achieve by adding the below code in .csproj of that project

                  <PropertyGroup>
                  <!-- Exclude the project from analysis -->
                  <SonarQubeExclude>true</SonarQubeExclude>
                  </PropertyGroup>
                  

                2. 从项目中排除文件

                3. To exclude a file from a project

                   <ItemGroup>
                   <SonarQubeSetting Include="sonar.coverage.exclusions">
                   <Value>**/FileName.cs</Value>
                   </SonarQubeSetting>
                   </ItemGroup>
                  

                4. 对于多个文件

                5. And for multiple files

                  <ItemGroup>
                  <SonarQubeSetting Include="sonar.coverage.exclusions">
                  <Value>**/FileName1.cs, **/FileName2.cs</Value>
                  </SonarQubeSetting>
                  </ItemGroup>
                  

                6. 也可以参考 正则表达式模式 使用过

                  这篇关于如何使 Sonarqube 从覆盖度量中排除 .NET (C#) 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
                  Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
                  How to store delegates in a List(如何将代表存储在列表中)
                  How delegates work (in the background)?(代表如何工作(在后台)?)
                  C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
                  Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)

                        <tbody id='qUNxc'></tbody>

                      <legend id='qUNxc'><style id='qUNxc'><dir id='qUNxc'><q id='qUNxc'></q></dir></style></legend>
                      <i id='qUNxc'><tr id='qUNxc'><dt id='qUNxc'><q id='qUNxc'><span id='qUNxc'><b id='qUNxc'><form id='qUNxc'><ins id='qUNxc'></ins><ul id='qUNxc'></ul><sub id='qUNxc'></sub></form><legend id='qUNxc'></legend><bdo id='qUNxc'><pre id='qUNxc'><center id='qUNxc'></center></pre></bdo></b><th id='qUNxc'></th></span></q></dt></tr></i><div id='qUNxc'><tfoot id='qUNxc'></tfoot><dl id='qUNxc'><fieldset id='qUNxc'></fieldset></dl></div>

                          <bdo id='qUNxc'></bdo><ul id='qUNxc'></ul>
                          1. <tfoot id='qUNxc'></tfoot>

                            <small id='qUNxc'></small><noframes id='qUNxc'>