我已经咨询过configuration documentation,但找不到任何内容。
我想禁用以下两个规则:
SA1633: The file header is missing or not located at the top of the file.
SA1652: Enable XML documentation output.
我的stylecop.json
看起来像这样:
{
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"orderingRules": {
"usingDirectivesPlacement": "outsideNamespace"
}
}
}
有什么想法吗?
答案 0 :(得分:7)
启用和禁用规则是通过规则集文件完成的,而不是配置.json
文件。有关使用规则集文件的详细信息,请参阅https://msdn.microsoft.com/en-us/library/dd264996.aspx。
答案 1 :(得分:2)
替代方法是在GlobalSuppressions.cs中指定抑制属性,如下所示:
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File must have header", Justification = "<Pending>")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1652:Enable XML documentation output", Justification = "<Pending>")]