如何配置了StyleCop到晚饭上生成code preSS警告? [英] How to configure StyleCop to suppress warnings on generated code?
问题描述
另一个项目,Visual Studio的code分析有这个选项。但我无法找到它了StyleCop(AKA源分析)。
Another project, Visual Studio's Code Analysis has this option. But I couldn't find it for StyleCop (AKA Source Analysis).
我想忽略该文件是一个DBML的了.Designer.cs code,其中包含 //<自动生成>
标记。 一个博客帖子告诉我,这将是足够的,但对我来说是不
The file I want to ignore is a dbml's .designer.cs code, that includes the // <autogenerated>
tag. A blog post tells me that it would be sufficient, but in my case it is not.
推荐答案
编辑:这是我在生成语法的ANTLR使用的标题。这实际上是一个StringTemplate的模板的身体,所以这两个 \&GT;
项实际上只是躲过&GT;
标记。除了&LT;自动生成&GT;
标记和 [生成code]
属性,我们仍然有禁用一些警告,这在code的分析出现了。
Here is the header I use in generated grammars for ANTLR. This is actually the body of a StringTemplate template, so the two \>
entries are actually just escaped >
marks. Aside from the <auto-generated>
tag and the [GeneratedCode]
attribute, we still had to disable some warnings which appeared during code analysis.
//------------------------------------------------------------------------------
// \<auto-generated>
// This code was generated by a tool.
// ANTLR Version: ANTLRVersion
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// \</auto-generated>
//------------------------------------------------------------------------------
// $ANTLR <ANTLRVersion> <fileName>
// The variable 'variable' is assigned but its value is never used.
#pragma warning disable 219
// Unreachable code detected.
#pragma warning disable 162
// Missing XML comment for publicly visible type or member 'Type_or_Member'
#pragma warning disable 1591
// CLS compliance checking will not be performed on 'type' because it is not visible from outside this assembly.
#pragma warning disable 3019
// 'type' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute.
#pragma warning disable 3021
[System.CodeDom.Compiler.GeneratedCode("ANTLR", "<ANTLRVersion>")]
[System.CLSCompliant(false)]
public class ...
这篇关于如何配置了StyleCop到晚饭上生成code preSS警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!