2021-10-08 05:46:46 +03:00
|
|
|
# EditorConfig is awesome: https://EditorConfig.org
|
|
|
|
|
2021-10-28 03:40:11 +03:00
|
|
|
# Top-most EditorConfig file
|
2021-10-08 05:46:46 +03:00
|
|
|
root = true
|
|
|
|
|
2021-10-28 03:40:11 +03:00
|
|
|
# Default
|
|
|
|
[*]
|
|
|
|
charset = utf-8
|
|
|
|
indent_style = space
|
2022-08-10 07:49:36 +03:00
|
|
|
insert_final_newline = true
|
2021-10-28 03:40:11 +03:00
|
|
|
|
|
|
|
# Source code
|
|
|
|
[*.{cs,ps1,psd1,psm1}]
|
|
|
|
indent_size = 4
|
|
|
|
|
|
|
|
# Xml project files
|
|
|
|
[*.{csproj,resx,ps1xml}]
|
|
|
|
indent_size = 2
|
|
|
|
|
|
|
|
# C# files
|
2021-10-08 05:46:46 +03:00
|
|
|
[*.cs]
|
2021-10-28 03:40:11 +03:00
|
|
|
|
2022-01-06 08:45:14 +03:00
|
|
|
# Code style defaults
|
2023-12-21 08:32:21 +03:00
|
|
|
csharp_using_directive_placement = outside_namespace:error
|
2023-06-04 11:00:24 +03:00
|
|
|
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
|
2024-09-25 06:47:09 +03:00
|
|
|
dotnet_sort_system_directives_first = true:error
|
2022-01-06 08:45:14 +03:00
|
|
|
dotnet_style_readonly_field = true:suggestion
|
2023-12-21 08:32:21 +03:00
|
|
|
csharp_style_namespace_declarations = file_scoped:error
|
2024-09-25 06:47:09 +03:00
|
|
|
dotnet_diagnostic.IDE0005.severity = error
|
2021-10-28 03:40:11 +03:00
|
|
|
|
|
|
|
# License header
|
|
|
|
file_header_template = Copyright (c) Microsoft Corporation.\nLicensed under the MIT License.
|
2023-12-21 08:32:21 +03:00
|
|
|
dotnet_diagnostic.IDE0073.severity = error
|
2021-10-28 03:40:11 +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
|
2022-01-06 08:45:14 +03:00
|
|
|
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
|
|
|
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
2021-10-28 03:40:11 +03:00
|
|
|
csharp_prefer_simple_default_expression = true:suggestion
|
|
|
|
|
2023-06-04 11:00:24 +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-01-06 08:45:14 +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-04 11:00:24 +03:00
|
|
|
csharp_style_inlined_variable_declaration = true:suggestion
|
2022-08-10 07:49:36 +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
|