1. <legend id='ej8Ro'><style id='ej8Ro'><dir id='ej8Ro'><q id='ej8Ro'></q></dir></style></legend>

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

        <bdo id='ej8Ro'></bdo><ul id='ej8Ro'></ul>

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

      1. <tfoot id='ej8Ro'></tfoot>

      2. 带有 C# 插件和 MSBuild Runner 的 SonarQube 不会排除

        时间:2023-10-24

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

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

            • <legend id='Cnq8r'><style id='Cnq8r'><dir id='Cnq8r'><q id='Cnq8r'></q></dir></style></legend>

                  本文介绍了带有 C# 插件和 MSBuild Runner 的 SonarQube 不会排除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  目前我有一个带有 C# 插件和 MSBuild 运行器的 SonarQube 5.1.2 实例,以便分析 1.200.000 LOC 项目.我打算减少要分析的类,我创建了一个带有

                  Currently I have an instance of SonarQube 5.1.2 with C# plugin and MSBuild runner in order to analyze a 1.200.000 LOC project. I intend to reduce the classes that are analyzed, I created a sonar.properties file with the line

                  sonar.exclusions=**/Databases/**/*.*
                  

                  但是在从分析中读取日志后,Databases 文件夹中的文件被分析了.按照 Eric Starr 的说明,我设置了runner 调用中的这个简单的排除规则:

                  but after reading the log from the analysis, files inside the Databases folder were analyzed. following the instructions from Eric Starr, I set this simple exclusion rule in the call of the runner:

                  "C:sonarqube-5.1.2inMSBuild.SonarQube.Runner.exe" begin /k:MyProject /n:MyProject /v:2 /d:sonar.exclusions="file:C:codesourceDatabases/**/*.*" /d:sonar.scm.provider=tfvc /d:sonar.tfvc.username=*************  /d:sonar.tfvc.password.secured={aes}*************************** "/d:sonar.cs.vscoveragexml.reportsPaths=C:codesourceCodeCoverageResults.coveragexml"
                  

                  我发现跑步者创建了一个 sonar-project.properties 文件,它包含很多位于数据库文件夹中的文件:

                  I found that the runner creates a sonar-project.properties file, and it contains a lot of files located in the databases folder:

                  BC78C8C4-8ECD-47CB-9781-F621AE109FE4.sonar.projectName=myDatabase
                  BC78C8C4-8ECD-47CB-9781-F621AE109FE4.sonar.projectBaseDir=BC78C8C4-8ECD-47CB-9781-F621AE109FE4.sonar.projectName=myDatabase
                  BC78C8C4-8ECD-47CB-9781-F621AE109FE4.sonar.projectBaseDir=C:\codesource\Databases\myDatabase
                  BC78C8C4-8ECD-47CB-9781-F621AE109FE4.sonar.sources=
                  C:\codesource\Databases\myDatabase\Scripts\PreDeployment\PATCH_20150527_01.sql,
                  C:\codesource\Databases\myDatabase\Scripts\PreDeployment\ROCOMMON.DBVERSION.sql,
                  ,.....
                  

                  据我了解,数据库文件夹中应该没有文件.我错了吗?

                  as I understood, there should be no files in the databases folder. Am I wrong?

                  推荐答案

                  您正在使用 SonarQube Scanner for MSBuild 与常规 SonarQube 扫描仪有很大不同a> 用于所有其他语言.

                  You are using the SonarQube Scanner for MSBuild which is very different from the regular SonarQube Scanner used for all other languages.

                  您尝试使用的 sonar.exclude 行仅在您使用常规 SonarQube 扫描仪时才有效,因为它包含 Sonar-project.properties 文件.适用于 MSBuild 的 SonarQube 扫描仪只有一个 SonarQube.Analysis.Xml 文件,其中包含您可以调整的项目相关设置.

                  The sonar.exclude line that you are trying to use would only work if you would use the regular SonarQube scanner, because that takes in the Sonar-project.properties file. The SonarQube Scanner for MSBuild only has a SonarQube.Analysis.Xml file that contains project-related settings that you can tweak.

                  您可以对 SonarQube.Analysis.Xml 文件使用几种覆盖策略:

                  You can use couple of overwriting strategies for the SonarQube.Analysis.Xml file:

                  • MSBuild *.*proj 文件中定义的项目特定属性(对应于 SonarQube 模块)可以覆盖:
                  • 在命令行中定义的属性 (/d:propertyName=value) 具有可以覆盖:
                  • SonarQube.Analysis.xml 配置文件中定义的属性
                  • 在项目级别的 SonarQube 用户界面中定义的属性,可以覆盖所有内容
                  • 在 SonarQube 用户界面中定义的全局级别的属性,不能覆盖任何内容

                  要从您的解决方案中排除特定文件夹或扩展:

                  您需要将排除项添加到每个单独项目的 .csproj 文件中.这是您应该在主根节点中使用的语法,称为 <Project...> 并用于目标之一,最好是 <Target Name="BeforeBuild">.希望下面的语法足够不言自明,但如果不是,请在此答案下发表评论,我会立即更新.

                  You need to add the excludes into each individual projects' .csproj file. Here's the syntax which you should use within the main root node, called <Project...> and into one of the targets, preferably <Target Name="BeforeBuild">. Hope the syntax below is self-explanetory enough, but in case it isn't, please leave a comment under this answer and I'll update it right away.

                  <Target Name="BeforeBuild">
                      <ItemGroup>
                            <SonarQubeSetting Include="sonar.exclusions">
                                <Value>**/Databases/**/*</Value>
                            </SonarQubeSetting>
                        </ItemGroup>
                    </Target>
                  

                  希望对你有帮助!

                  来源

                  这篇关于带有 C# 插件和 MSBuild Runner 的 SonarQube 不会排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  1. <tfoot id='7ZTvk'></tfoot>

                          <tbody id='7ZTvk'></tbody>

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

                          <small id='7ZTvk'></small><noframes id='7ZTvk'>