MSBuild SonarQube运行程序跳过自动生成的文件? [英] MSBuild SonarQube runner skipping auto-generated files?
问题描述
我已经设置了本地SonarQube 5.1.1服务器.我还安装了C#插件(4.1版)以及MSBuild运行程序(1.0版).然后,我在.NET代码库上为我当前正在处理的项目执行了两个单独的运行:
I have set up a local SonarQube 5.1.1 server. I have also installed the C# plugin (version 4.1), as well as the MSBuild runner (version 1.0). I then performed two separate runs on the .NET codebase for the project I am currently working on:
- 使用声纳运行器和C#插件
- 使用MSBuild运行器
两次运行均通过CLI进行.但是,这些运行产生了截然不同的结果.这是一个示例:SonarQube在第一次运行中计算出的代码行数约为956 000,而在第二次运行中计算得出的行数"仅为434000.然后我进行了一些挖掘,似乎后者会跳过一些自动生成的文件.这些文件/类是由内部开发的旧版ORM工具生成的.
Both runs were made through the CLI. However, the runs yielded very different results. Here is an example: In the first run SonarQube calculated the number of code lines to be roughly 956 000, while in the second run it was calculated to be "only" about 434 000. I then did some digging, and it seems like the latter skips some auto-generated files. These files/classes were generated by an old, internally developed ORM tool.
我认为,除非另有说明-通过使用包含/排除模式-MSBuild SonarQube运行程序将分析给定项目中的每个单个.cs文件,但是显然并非如此.
I thought that unless specified otherwise - by using include/exclude patterns - the MSBuild SonarQube runner would analyse every single .cs file in a given project, but apparently that is not the case.
有人遇到过相同的问题"吗?有人知道哪种自动生成的文件将自动从分析中排除吗?
Has anyone experienced the same "problem", and does anyone know what kind of auto-generated files that will be automatically excluded from an analysis?
推荐答案
我在"某些类型的项目将自动从分析中排除.例如,Microsoft Fakes在构建过程中会生成其他项目.这些自动生成的项目将不会进行分析."
和
"由Visual Studio中的自定义工具生成的文件会自动从分析中排除,例如从.resx文件生成的xxx.Designer.cs文件:"
我认为我们的内部ORM工具属于后一类.因此,这说明了为什么将这些文件从分析中排除.
I assume that our internal ORM tool falls into the latter category. Thus, that explains why those files are being excluded from the analysis.
这篇关于MSBuild SonarQube运行程序跳过自动生成的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!