我正在编写一个 editorconfig 文件来强制执行一些编码样式,并且我想强制常量应该是大写的,所以我在 editorConfig 文件中创建了以下规则:
dotnet_naming_rule.constants_must_be_uppercase.symbols = public_constants
dotnet_naming_symbols.public_constants.applicable_kinds = field
dotnet_naming_symbols.public_constants.applicable_accessibilities = *
dotnet_naming_symbols.public_constants.required_modifiers = const
dotnet_naming_rule.constants_must_be_uppercase.style = uppercase_with_underscore_separator
dotnet_naming_style.uppercase_with_underscore_separator.capitalization = all_upper
dotnet_naming_style.uppercase_with_underscore_separator.word_separator = _
dotnet_naming_rule.constants_must_be_uppercase.severity = warning
我正在使用以下代码对此进行测试:
namespace XYZ
{
public class Foo
{
public const string Bar = "bar";
}
}
但是,Visual Studio 并不表示该行不正确。是错误还是我的文件不正确?