我试图在 StyleCop 中抑制 SA1649 错误的两次出现。
根据documentation抑制属性看起来像下面的属性
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:FileHeaderFileNameDocumentationMustMatchTypeName", Justification = "Reviewed.")]
但是,我不知道应该将属性应用到哪个元素。如果我将属性放在文件的第一个元素(IClassFactory 接口(interface))上,我会收到以下错误:
SA1649 : CSharp.Documentation : The file attribute in the file header's copyright tag must contain the name of the first type in the file and can be any of these: "IClassFactory" C:(...)COMHelper.cs
可以抑制该错误吗?它应该应用于什么元素?
最佳答案
使用命名空间级别抑制:
[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:FileHeaderFileNameDocumentationMustMatchTypeName", Justification = "Reviewed.")]
namespace MyNamespace
{
}
关于c# - 如何抑制 StyleCop 警告 SA1649,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23019604/