Skip to content

Commit

Permalink
add naming rules for the library projects
Browse files Browse the repository at this point in the history
  • Loading branch information
smdn committed Dec 17, 2023
1 parent ac696f5 commit 5118a31
Showing 1 changed file with 96 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,102 @@ dotnet_diagnostic.IDE0008.severity = none # Use explicit type instea
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0055
dotnet_diagnostic.IDE0055.severity = silent # Fix formatting

#
# Code-style naming rules
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/naming-rules
#

# Static readonly fields must be PascalCase
dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = warning
dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.symbols = static_readonly_fields
dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.style = static_readonly_field_style

dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = *
dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly

dotnet_naming_style.static_readonly_field_style.capitalization = pascal_case

# Non-private static fields must be PascalCase
dotnet_naming_rule.non_private_static_fields_must_be_pascal_case.severity = warning
dotnet_naming_rule.non_private_static_fields_must_be_pascal_case.symbols = non_private_static_fields
dotnet_naming_rule.non_private_static_fields_must_be_pascal_case.style = non_private_static_field_style

dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static

dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case

# Non-private readonly fields must be PascalCase
dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.severity = warning
dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.symbols = non_private_readonly_fields
dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.style = non_private_readonly_field_style

dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly

dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case

# Non-private fields must be PascalCase
dotnet_naming_rule.non_private_fields_must_be_pascal_case.severity = warning
dotnet_naming_rule.non_private_fields_must_be_pascal_case.symbols = non_private_fields
dotnet_naming_rule.non_private_fields_must_be_pascal_case.style = non_private_field_style

dotnet_naming_symbols.non_private_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
dotnet_naming_symbols.non_private_fields.required_modifiers =

dotnet_naming_style.non_private_field_style.capitalization = pascal_case

# Constants must be PascalCase
dotnet_naming_rule.constants_must_be_pascal_case.severity = warning
dotnet_naming_rule.constants_must_be_pascal_case.symbols = constants
dotnet_naming_rule.constants_must_be_pascal_case.style = constant_style

dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const

dotnet_naming_style.constant_style.capitalization = pascal_case

# Other static/instance fields must be camelCase and must not start with any prefix
dotnet_naming_rule.other_fields_must_be_camel_case_without_prefix.severity = warning
dotnet_naming_rule.other_fields_must_be_camel_case_without_prefix.symbols = other_fields
dotnet_naming_rule.other_fields_must_be_camel_case_without_prefix.style = other_field_style

dotnet_naming_symbols.other_fields.applicable_kinds = field

dotnet_naming_style.other_field_style.capitalization = camel_case
dotnet_naming_style.other_field_style.required_prefix =

# Locals and parameters are camelCase
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
dotnet_naming_rule.locals_should_be_camel_case.style = local_and_parameter_style

dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local

dotnet_naming_style.local_and_parameter_style.capitalization = camel_case

# Local functions are PascalCase
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style

dotnet_naming_symbols.local_functions.applicable_kinds = local_function

dotnet_naming_style.local_function_style.capitalization = pascal_case

# By default, name items with PascalCase
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style

dotnet_naming_symbols.all_members.applicable_kinds = *

dotnet_naming_style.pascal_case_style.capitalization = pascal_case



#
Expand Down

0 comments on commit 5118a31

Please sign in to comment.