简体   繁体   English

从SonarLint分析中删除自动生成的代码

[英]Remove Auto-generated Code from SonarLint Analysis

Background 背景

I am running Visual Studio 2015 Enterprise (RTM) and have enabled the SonarLint extension for code analysis of my multi-project ASP.NET 4.5 MVC solution. 我正在运行Visual Studio 2015 Enterprise(RTM),并已启用SonarLint扩展程序来对我的多项目ASP.NET 4.5 MVC解决方案进行代码分析。

Problem 问题

SonarLint analysis seems to be ignoring the project setting for Code Analysis "Suppress results from generated code (managed only)" SonarLint分析似乎忽略了代码分析的项目设置“抑制生成的代码的结果(仅托管)”

That is, I'm getting a lot of Sonar errors reported back for a couple of *.designer.cs files generated from some .aspx pages. 也就是说,对于从某些.aspx页面生成的*.designer.cs文件,我收到了许多Sonar错误的报告。 (Most of the project is MVC, for what it's worth.) I don't care about these errors, and don't think I have a decent path for fixing them... (该项目的大部分都是MVC,因为它的价值。)我不在乎这些错误,也不认为我有解决它们的正确方法...

More Details 更多细节

I have SonarQube integrated with our TFS 2013 environment, and it is correctly ignoring these issues on the TFS server analysis. 我已经将SonarQube与我们的TFS 2013环境集成在一起,并且它在TFS服务器分析中正确地忽略了这些问题。 This problem is just showing up in Visual Studio, using the Roslyn analysis. 使用Roslyn分析,此问题仅在Visual Studio中显示。

Any ideas how I can set up the equivalent of an .ignore file or otherwise fix this? 有什么想法可以设置等效的.ignore文件或以其他方式解决此问题?

There is no built-in way of ignoring files in Roslyn at the moment, so you can't do it. 目前,Roslyn中没有内置的忽略文件的方法,因此您无法做到这一点。 Each analyzer needs to decide if the analyzed file needs to be checked or not. 每个分析器都需要确定是否需要检查分析的文件。 Specifically for SonarLint, I've created an issue on GitHub: https://github.com/SonarSource/sonarlint-vs/issues/85 . 专门针对SonarLint,我在GitHub上创建了一个问题: https : //github.com/SonarSource/sonarlint-vs/issues/85 You can track its progress. 您可以跟踪其进度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM