2016-12-12 99 views
2

在SonarQube跑步者中,可以通过sonar项目属性中的sonar.exclusions属性来管理排除的项目。这样我们就可以独立于代码库管理构建配置。用于MSBuild的SonarQube扫描仪:排除

我们正在从亚军移植到MSBuild的扫描仪,以便利用我们的代码运行FXCop规则。

留在项目成果的根文件夹的文件sonar-project.properties在“MSBuild.SonarQube.Runner.exe结束”命令异常。 SonarQube扫描仪不能理解sonar-project.properties文件的MSBuild。从以下文件夹中删除这些文件:[文件夹]

我现在看到的唯一选项是排除特定项目(实际上名称以.Test,.Tests,.Testing,.UnitTests等结尾的所有项目)将项目属性添加到每个受影响项目中的propertyGroup中:<SonarQubeExclude>true</SonarQubeExclude> 与管理根级别(我们为jenkins所做的设置)或生成设置(与设置相比),这很难维护,容易出错并且很麻烦我们目前在TeamCity中使用)。

有没有其他的选择?或计划未来?

当项目文件夹被称为***。测试时,它在添加到排除设置后仍然被扫描。

[14:14:14][Step 12/23] INFO: ------------- Scan MyProject.Tests 
[14:14:14][Step 12/23] INFO: Excluded sources for coverage: 
[14:14:14][Step 12/23] INFO: **/*.Tests/**/* 
[14:14:14][Step 12/23] INFO: **/*.Test/**/* 
[14:14:14][Step 12/23] INFO: Base dir: C:\SomeFolder\MyProject\Modules\MyProject.Tests 
[14:14:14][Step 12/23] INFO: Working dir: C:\SomeFolder\MyProject\.sonarqube\out\.sonar\{Sonar_Project}_{some guid} 
[14:14:14][Step 12/23] INFO: Test paths: [I removed some classes], Utils/SomeTests.cs, Enum/dummy.resx, app.config, Compression/TestData/data1.FRM, Compression/TestData/data1.zip, Compression/TestData/data1.Off.zip, packages.config 
[14:14:14][Step 12/23] INFO: Source encoding: UTF-8, default locale: en_US 
[14:14:14][Step 12/23] INFO: Index files 
[14:14:15][Step 12/23] INFO: 45 files indexed 
[14:14:15][Step 12/23] INFO: Quality profile for cs: [some profile] 
[14:14:15][Step 12/23] INFO: Quality profile for vb: [some profile] 

回答

1

在分析参数中没有关于管理这些属性组的文档,因为它很难得到正确的结果。相反,您应该使用用户界面来管理排除项目:管理>常规设置>分析范围

欲了解更多,see the docs

+0

当项目文件夹被称为** \ *。测试时,尽管有排除设置,仍会对其进行扫描。 – Reinout

+0

我在开篇文章中添加了一些日志消息。 – Reinout

+0

因为在分析参数中没有管理这些属性组的文档,所以很难获得正确的结果。 –

相关问题