2021-10-10 07:34:51 +03:00
|
|
|
# EditorConfig is awesome: https://EditorConfig.org
|
|
|
|
|
2022-02-12 11:29:13 +03:00
|
|
|
# Top-most EditorConfig file
|
2021-10-10 07:34:51 +03:00
|
|
|
root = true
|
|
|
|
|
2022-02-12 11:29:13 +03:00
|
|
|
# Default
|
|
|
|
[*]
|
|
|
|
charset = utf-8
|
|
|
|
indent_style = space
|
2022-08-18 12:51:16 +03:00
|
|
|
insert_final_newline = true
|
2022-02-12 11:29:13 +03:00
|
|
|
|
|
|
|
# Source code
|
|
|
|
[*.{cs,ps1,psd1,psm1}]
|
|
|
|
indent_size = 4
|
|
|
|
|
|
|
|
# Xml project files
|
|
|
|
[*.{csproj,resx,ps1xml}]
|
|
|
|
indent_size = 2
|
|
|
|
|
|
|
|
# C# files
|
2021-10-10 07:34:51 +03:00
|
|
|
[*.cs]
|
2022-02-12 11:29:13 +03:00
|
|
|
|
|
|
|
# Code style defaults
|
2024-10-12 13:26:58 +03:00
|
|
|
csharp_using_directive_placement = outside_namespace:error
|
2023-06-07 04:40:46 +03:00
|
|
|
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
|
|
|
|
csharp_preferred_modifier_order.severity = suggestion
|
2024-10-12 13:26:58 +03:00
|
|
|
dotnet_sort_system_directives_first = true:error
|
2022-02-12 11:29:13 +03:00
|
|
|
dotnet_style_readonly_field = true:suggestion
|
2023-06-07 04:40:46 +03:00
|
|
|
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
|
|
|
|
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
2024-10-12 13:26:58 +03:00
|
|
|
csharp_style_namespace_declarations = file_scoped:suggestion
|
|
|
|
dotnet_diagnostic.IDE0005.severity = error
|
2022-02-12 11:29:13 +03:00
|
|
|
|
|
|
|
# License header
|
|
|
|
file_header_template = Copyright (c) Microsoft Corporation.\nLicensed under the MIT License.
|
2024-10-12 13:26:58 +03:00
|
|
|
dotnet_diagnostic.IDE0073.severity = error
|
2022-02-12 11:29:13 +03:00
|
|
|
|
|
|
|
# Suggest more modern language features when available
|
|
|
|
dotnet_style_object_initializer = true:suggestion
|
|
|
|
dotnet_style_collection_initializer = true:suggestion
|
|
|
|
dotnet_style_explicit_tuple_names = true:suggestion
|
|
|
|
dotnet_style_coalesce_expression = true:suggestion
|
|
|
|
dotnet_style_null_propagation = true:suggestion
|
|
|
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
|
|
|
|
dotnet_style_prefer_inferred_tuple_names = true:suggestion
|
|
|
|
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
|
|
|
|
dotnet_style_prefer_auto_properties = true:suggestion
|
|
|
|
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
|
|
|
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
|
|
|
csharp_prefer_simple_default_expression = true:suggestion
|
|
|
|
|
2023-06-07 04:40:46 +03:00
|
|
|
# Pattern matching
|
|
|
|
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
|
|
|
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
|
|
|
csharp_style_prefer_not_pattern = true:suggestion
|
|
|
|
csharp_style_prefer_switch_expression = false:none
|
|
|
|
csharp_style_prefer_pattern_matching = false:none
|
|
|
|
|
2022-02-12 11:29:13 +03:00
|
|
|
# Prefer "var" everywhere
|
|
|
|
csharp_style_var_for_built_in_types = true:suggestion
|
|
|
|
csharp_style_var_when_type_is_apparent = true:suggestion
|
2023-06-07 04:40:46 +03:00
|
|
|
csharp_style_inlined_variable_declaration = true:suggestion
|
2022-08-18 12:51:16 +03:00
|
|
|
csharp_style_var_elsewhere = true:suggestion
|
|
|
|
|
|
|
|
# Define the 'private_fields' symbol group:
|
|
|
|
dotnet_naming_symbols.private_fields.applicable_kinds = field
|
|
|
|
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
|
|
|
|
|
|
|
|
# Define the 'private_static_fields' symbol group
|
|
|
|
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
|
|
|
|
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private
|
|
|
|
dotnet_naming_symbols.private_static_fields.required_modifiers = static
|
|
|
|
|
|
|
|
# Define the 'underscored' naming style
|
|
|
|
dotnet_naming_style.underscored.capitalization = pascal_case
|
|
|
|
dotnet_naming_style.underscored.required_prefix = _
|
|
|
|
|
|
|
|
# Private instance fields must use pascal case with a leading '_'
|
|
|
|
dotnet_naming_rule.private_fields_underscored.symbols = private_fields
|
|
|
|
dotnet_naming_rule.private_fields_underscored.style = underscored
|
|
|
|
dotnet_naming_rule.private_fields_underscored.severity = error
|
|
|
|
|
|
|
|
# Exclude private static fields from underscored style
|
|
|
|
dotnet_naming_rule.private_static_fields_none.symbols = private_static_fields
|
|
|
|
dotnet_naming_rule.private_static_fields_none.style = underscored
|
|
|
|
dotnet_naming_rule.private_static_fields_none.severity = none
|