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

chore: adjust naming rules #115

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
## Styles
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_style.camel_case_style.capitalization = camel_case
dotnet_naming_style.interface_style.capitalization = pascal_case
dotnet_naming_style.interface_style.required_prefix = I
dotnet_naming_style.type_parameter_style.capitalization = pascal_case
dotnet_naming_style.type_parameter_style.required_prefix = T
dotnet_naming_style.underscore_camel_case_style.capitalization = camel_case
dotnet_naming_style.underscore_camel_case_style.required_prefix = _

Expand All @@ -138,9 +142,14 @@ dotnet_naming_symbols.non_interface_symbol.applicable_accessibilities = *
# Constants
dotnet_naming_symbols.constant_symbol.applicable_kinds = field
dotnet_naming_symbols.constant_symbol.required_modifiers = const
# Static readonly fields
dotnet_naming_symbols.static_readonly_field_symbol.applicable_kinds = field
dotnet_naming_symbols.static_readonly_field_symbol.required_modifiers = static, readonly
# Public, internal and protected static readonly fields
dotnet_naming_symbols.public_static_readonly_field_symbol.applicable_kinds = field
dotnet_naming_symbols.public_static_readonly_field_symbol.required_modifiers = static, readonly
dotnet_naming_symbols.public_static_readonly_field_symbol.applicable_accessibilities = public, internal, protected, protected_internal
# Private static readonly fields
dotnet_naming_symbols.private_static_readonly_field_symbol.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_field_symbol.required_modifiers = static, readonly
dotnet_naming_symbols.private_static_readonly_field_symbol.applicable_accessibilities = private
# Public symbols (properties, methods, events)
dotnet_naming_symbols.public_symbol.applicable_kinds = property, method, event
dotnet_naming_symbols.public_symbol.applicable_accessibilities = public, internal, protected, protected_internal
Expand All @@ -164,12 +173,12 @@ dotnet_naming_symbols.private_field_symbol.applicable_accessibilities = private
# Type parameters
dotnet_naming_symbols.type_parameter_symbol.applicable_kinds = type_parameter
dotnet_naming_symbols.type_parameter_symbol.applicable_accessibilities = *
# Paramters
# Parameters
dotnet_naming_symbols.parameter_symbol.applicable_kinds = parameter
dotnet_naming_symbols.parameter_symbol.applicable_accessibilities = *
# Everything local
dotnet_naming_symbols.local_symbol.applicable_kinds = local
dotnet_naming_symbols.local_symboleverything_else.applicable_accessibilities = *
dotnet_naming_symbols.local_symbol.applicable_accessibilities = *

## Rules
# Interfaces must be prefixed with 'I'
Expand All @@ -184,10 +193,14 @@ dotnet_naming_rule.non_interface_naming.severity = warning
dotnet_naming_rule.constant_naming.symbols = constant_symbol
dotnet_naming_rule.constant_naming.style = pascal_case_style
dotnet_naming_rule.constant_naming.severity = warning
# Static readonly fields must be PascalCase
dotnet_naming_rule.static_readonly_field_naming.symbols = static_readonly_field_symbol
dotnet_naming_rule.static_readonly_field_naming.style = pascal_case_style
dotnet_naming_rule.static_readonly_field_naming.severity = warning
# Public, internal and protected static readonly fields must be PascalCase
dotnet_naming_rule.public_static_readonly_field_naming.symbols = public_static_readonly_field_symbol
dotnet_naming_rule.public_static_readonly_field_naming.style = pascal_case_style
dotnet_naming_rule.public_static_readonly_field_naming.severity = warning
# Private static readonly fields must be _camelCase
dotnet_naming_rule.private_static_readonly_field_naming.symbols = private_static_readonly_field_symbol
dotnet_naming_rule.private_static_readonly_field_naming.style = underscore_camel_case_style
dotnet_naming_rule.private_static_readonly_field_naming.severity = warning
# Public symbols must be PascalCase
dotnet_naming_rule.public_symbol_naming.symbols = public_symbol
dotnet_naming_rule.public_symbol_naming.style = pascal_case_style
Expand All @@ -212,7 +225,7 @@ dotnet_naming_rule.private_readonly_field_naming.severity = warning
dotnet_naming_rule.private_field_naming.symbols = private_field_symbol
dotnet_naming_rule.private_field_naming.style = underscore_camel_case_style
dotnet_naming_rule.private_field_naming.severity = warning
# Paramters must be camelCase
# Parameters must be camelCase
dotnet_naming_rule.parameter_naming.symbols = parameter_symbol
dotnet_naming_rule.parameter_naming.style = camel_case_style
dotnet_naming_rule.parameter_naming.severity = warning
Expand Down
3 changes: 2 additions & 1 deletion docs/en/contributing/code-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ The following naming conventions should be followed:
* Interfaces: `I` prefix and `PascalCase` (e.g. `IInterface`)
* Non-Interface types (classes, structs, enums, delegates and namespaces): `PascalCase` (e.g. `ClassName`)
* Constant fields: `PascalCase` (e.g. `ConstantName`)
* Static readonly fields: `PascalCase` (e.g. `StaticReadonlyFieldName`)
* Public, internal and protected static readonly fields: `PascalCase` (e.g. `StaticReadonlyFieldName`)
* Private static readonly fields: `_` prefix and `camelCase` (e.g. `_privateStaticReadonlyField`)
* Public symbols (properties, methods and events): `PascalCase` (e.g. `PublicSymbol`)
* Public, internal and protected readonly fields: `PascalCase` (e.g. `ReadonlyFieldName`)
* Protected fields: `camelCase` (e.g. `protectedField`)
Expand Down