2017-02-23 08:02:01 +03:00
# EditorConfig is awesome:http://EditorConfig.org
# top-most EditorConfig file
root = true
# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)
2019-05-29 23:06:38 +03:00
trim_trailing_whitespace = true
2017-02-23 08:02:01 +03:00
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
2020-08-05 00:20:34 +03:00
insert_final_newline = true
2021-02-01 20:18:09 +03:00
encoding = utf-8-bom
2017-02-23 08:02:01 +03:00
2021-08-04 22:58:12 +03:00
file_header_template = Copyright (c) .NET Foundation. All rights reserved.\nLicensed under the MIT license. See License.txt in the project root for license information.
2020-08-06 02:44:08 +03:00
2017-02-23 08:02:01 +03:00
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
# JSON files
[*.json]
indent_size = 2
2021-02-03 03:11:52 +03:00
# TypeScript files
[*.ts]
insert_final_newline = true
2017-02-23 08:02:01 +03:00
# Dotnet code style settings:
[*.cs]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
2020-10-16 02:41:32 +03:00
dotnet_separate_import_directive_groups = false
2017-02-23 08:02:01 +03:00
2022-10-05 08:19:16 +03:00
# IDE0005 - Remove unnecessary imports
dotnet_diagnostic.IDE0005.severity = suggestion
2021-01-21 20:21:16 +03:00
# IDE0046: If expression can be simplified
dotnet_style_prefer_conditional_expression_over_return = false:silent
2017-02-23 08:02:01 +03:00
# Don't use this. qualifier
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
# use int x = .. over Int32
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
# use int.MaxValue over Int32.MaxValue
dotnet_style_predefined_type_for_member_access = true:suggestion
# Require var all the time.
2020-08-06 02:44:08 +03:00
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = true:warning
2017-02-23 08:02:01 +03:00
# Disallow throw expressions.
csharp_style_throw_expression = false:suggestion
2021-12-01 03:07:51 +03:00
# Space settings
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
2017-02-23 08:02:01 +03:00
# Newline settings
2021-12-01 03:07:51 +03:00
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
2017-02-23 08:02:01 +03:00
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
2022-06-13 23:23:47 +03:00
# CA2254: The logging message template should not vary between calls to 'ILogger.Log*'
dotnet_diagnostic.CA2254.severity = warning
2021-12-01 03:07:51 +03:00
# csharp_style_allow_blank_lines_between_consecutive_braces_experimental
dotnet_diagnostic.IDE2002.severity = warning
# csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental
dotnet_diagnostic.IDE2004.severity = warning
# csharp_style_allow_embedded_statements_on_same_line_experimental
dotnet_diagnostic.IDE2001.severity = none
dotnet_style_allow_statement_immediately_after_block_experimental = false:warning
2020-08-06 02:44:08 +03:00
2020-10-16 02:41:32 +03:00
# IDE0058
csharp_style_unused_value_expression_statement_preference = discard_variable:none
# IDE0065
2022-10-05 08:19:16 +03:00
csharp_using_directive_placement = outside_namespace:suggestion
2021-03-31 10:02:36 +03:00
# xUnit1004: Test methods should not be skipped
2021-04-02 05:29:05 +03:00
dotnet_diagnostic.xUnit1004.severity = refactoring
2021-07-08 02:35:41 +03:00
2021-07-09 09:46:45 +03:00
# Non-private static fields are PascalCase
2021-07-10 03:08:16 +03:00
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
2021-07-09 09:46:45 +03:00
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
dotnet_naming_rule.non_private_static_fields_should_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 are PascalCase
2021-07-10 03:08:16 +03:00
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
2021-07-09 09:46:45 +03:00
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
dotnet_naming_rule.non_private_readonly_fields_should_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
# Constants are PascalCase
2021-07-10 03:08:16 +03:00
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
2021-07-09 09:46:45 +03:00
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
dotnet_naming_rule.constants_should_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
# Static fields are camelCase and start with s_
2021-07-10 03:08:16 +03:00
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
2021-07-09 09:46:45 +03:00
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_style.static_field_style.capitalization = camel_case
dotnet_naming_style.static_field_style.required_prefix = s_
2021-07-08 02:35:41 +03:00
# Instance fields are camelCase and start with _
2021-07-10 03:08:16 +03:00
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
2021-07-08 02:35:41 +03:00
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
dotnet_naming_symbols.instance_fields.applicable_kinds = field
dotnet_naming_style.instance_field_style.capitalization = camel_case
dotnet_naming_style.instance_field_style.required_prefix = _
2021-07-09 09:46:45 +03:00
# Locals and parameters are camelCase
2021-07-10 03:08:16 +03:00
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
2021-07-09 09:46:45 +03:00
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
dotnet_naming_style.camel_case_style.capitalization = camel_case
# Local functions are PascalCase
2021-07-10 03:08:16 +03:00
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
2021-07-09 09:46:45 +03:00
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
2021-07-10 03:08:16 +03:00
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
2021-07-09 09:46:45 +03:00
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 = *
2022-01-14 01:50:23 +03:00
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# VSTHRD100: Avoid async void methods
dotnet_diagnostic.VSTHRD100.severity = warning
2022-01-19 03:04:12 +03:00
dotnet_diagnostic.VSTHRD101.severity = warning
2022-10-05 08:19:16 +03:00
# Various settings that may not indicate desired style, but codify existing style
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
2022-11-11 02:51:45 +03:00
csharp_style_namespace_declarations = file_scoped:warning
2022-10-05 08:19:16 +03:00
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_indent_labels = one_less_than_current
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_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = false:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_compound_assignment = true:suggestion