使用 .editorconfig 更改所有 StyleCop 规则的严重性

问题描述 投票:0回答:1

如何使用 .editorconfig 更改

all
StyleCop 规则的严重性?

配置单独的规则有效:

dotnet_diagnostic.SA1202.severity = error

但是,我正在寻找影响每条规则的全局变化。

c# .net-6.0 stylecop editorconfig
1个回答
3
投票

如果您想要设置所有分析器的所有规则,请使用以下命令:

dotnet_analyzer_diagnostic.severity = error

如果您只想设置

Stylecop.Analyzers
包规则,请使用以下命令:

dotnet_analyzer_diagnostic.category-StyleCop.CSharp.AlternativeRules.severity = error
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = error
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.LayoutRules.severity = error
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.MaintainabilityRules.severity = error
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.NamingRules.severity = error
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.OrderingRules.severity = error
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.ReadabilityRules.severity = error
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpacingRules.severity = error
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpecialRules.severity = error

然后可以单独覆盖各个规则,如下所示:

dotnet_diagnostic.SA1400.severity = warning
© www.soinside.com 2019 - 2024. All rights reserved.