StyleCop.Analyzers:禁用 SA1633 和 SA1652
StyleCop.Analyzers: Disable SA1633 & SA1652
我已经查阅了 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"
}
}
}
有什么想法吗?
启用和禁用规则是通过规则集文件完成的,而不是配置 .json
文件。有关使用规则集文件的详细信息,请参阅 https://msdn.microsoft.com/en-us/library/dd264996.aspx。
另一种方法是在 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>")]
我已经查阅了 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"
}
}
}
有什么想法吗?
启用和禁用规则是通过规则集文件完成的,而不是配置 .json
文件。有关使用规则集文件的详细信息,请参阅 https://msdn.microsoft.com/en-us/library/dd264996.aspx。
另一种方法是在 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>")]