# 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.) trim_trailing_whitespace = true spelling_exclusion_path = SpellingExclusions.dic # Code files [*.{cs,csx,vb,vbx}] indent_size = 4 insert_final_newline = true charset = utf-8-bom 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. # 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 # Dotnet code style settings: [*.cs] # Sort using and Import directives with System.* appearing first dotnet_sort_system_directives_first = true dotnet_separate_import_directive_groups = false # IDE0005 - Remove unnecessary imports dotnet_diagnostic.IDE0005.severity = warning # IDE0052 - Private member can be removed dotnet_diagnostic.IDE0052.severity = warning # IDE0046: If expression can be simplified dotnet_style_prefer_conditional_expression_over_return = false:silent # IDE0060 - Remove unused parameter dotnet_diagnostic.IDE0060.severity = warning # 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. csharp_style_var_for_built_in_types = true:warning csharp_style_var_when_type_is_apparent = true:warning csharp_style_var_elsewhere = true:warning # Disallow throw expressions. csharp_style_throw_expression = false:suggestion # Space settings csharp_space_before_colon_in_inheritance_clause = true csharp_space_after_colon_in_inheritance_clause = true # Newline settings 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 # Roslyn experimental formatting settings # IDE2000, AllowMultipleBlankLines dotnet_style_allow_multiple_blank_lines_experimental = false:warning # IDE2001, AllowEmbeddedStatementsOnSameLine csharp_style_allow_embedded_statements_on_same_line_experimental = false:warning # IDE2002, AllowBlankLinesBetweenConsecutiveBraces csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning # IDE2003, AllowStatementImmediatelyAfterBlock dotnet_style_allow_statement_immediately_after_block_experimental = false:warning # IDE2004, AllowBlankLineAfterColonInConstructorInitializer csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:warning # IDE2005, AllowBlankLineAfterTokenInConditionalExpression csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false:warning # IDE2006, AllowBlankLineAfterTokenInArrowExpressionClause # TODO: csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false:warning # CA2254: The logging message template should not vary between calls to 'ILogger.Log*' dotnet_diagnostic.CA2254.severity = warning # CA1305: Provide a value for the 'IFormatProvider' argument dotnet_diagnostic.CA1305.severity = none # IDE0058 csharp_style_unused_value_expression_statement_preference = discard_variable:none # IDE0065 csharp_using_directive_placement = outside_namespace:suggestion # Roslyn analyzers dotnet_diagnostic.RS0006.severity = error dotnet_diagnostic.RS0023.severity = error # xUnit1004: Test methods should not be skipped dotnet_diagnostic.xUnit1004.severity = refactoring # Non-private static fields are PascalCase dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion 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 dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion 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 dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion 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_ dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion 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_ # Instance fields are camelCase and start with _ dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion 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 = _ # 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 = 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 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 # VSTHRD100: Avoid async void methods dotnet_diagnostic.VSTHRD100.severity = warning dotnet_diagnostic.VSTHRD101.severity = warning # Various settings that may not indicate desired style, but codify existing style csharp_prefer_simple_using_statement = true:suggestion csharp_prefer_braces = true:silent csharp_style_namespace_declarations = file_scoped:warning 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