如何配置 StyleCop 以抑制生成代码的警告?
另一个项目,Visual Studio 的代码分析有这个选项。但我找不到 StyleCop(又名源分析)。
我想要忽略的文件是 dbml 的 .designer.cs 代码,其中包含 //
标记。 一篇博客文章告诉我这就足够了,但就我而言还不够。
Another project, Visual Studio's Code Analysis has this option. But I couldn't find it for StyleCop (AKA Source Analysis).
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
StyleCop:如何忽略生成的代码
编辑:这是我在 ANTLR 的生成语法中使用标头。这实际上是 StringTemplate 模板的主体,因此两个
\>
条目实际上只是转义的>
标记。除了
标签和[GenerateCode]
属性之外,我们仍然必须禁用代码分析期间出现的一些警告。StyleCop: How To Ignore Generated Code
Edit: 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.