Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom naming rules defined in .editorconfig do not work #2605

Open
arkaragian opened this issue Feb 24, 2024 · 0 comments
Open

Custom naming rules defined in .editorconfig do not work #2605

arkaragian opened this issue Feb 24, 2024 · 0 comments

Comments

@arkaragian
Copy link

I want to define a rule where I can define C style #define naming rules. For example the following examples are acceptable by my style

const string HELLO_WORLD = "Hello World!";
const string HELLO = "Hello World!";

But with my default .editorconfig setup I get the following diagnostic:

Diagnostics:
Remove the underscores from member name pmtk.Models.prline.HELLO_WORLD [CA1707]

Thus I have defined a new editorconfig rule:

# Custom Naming Style for const string values to mimic C style #define formatting
dotnet_naming_style.c_style_define.capitalization = all_upper
dotnet_naming_style.c_style_define.required_prefix =
dotnet_naming_style.c_style_define.required_suffix =
dotnet_naming_style.c_style_define.word_separator = _

# Symbol specification for const string fields
dotnet_naming_symbols.const_string_fields.applicable_kinds = field
dotnet_naming_symbols.const_string_fields.applicable_accessibilities = public, private, protected, internal
dotnet_naming_symbols.const_string_fields.required_modifiers = const

# Naming rule for const string fields to follow C style #define formatting
dotnet_naming_rule.const_strings_c_style.severity = error
dotnet_naming_rule.const_strings_c_style.symbols = const_string_fields
dotnet_naming_rule.const_strings_c_style.style = c_style_define

But this does not seem to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant