|
| 1 | +# Remove the line below if you want to inherit .editorconfig settings from higher directories |
| 2 | +root = true |
| 3 | + |
| 4 | +[*.{cs,xml,csproj,sln}] |
| 5 | + |
| 6 | +#Core editorconfig formatting - indentation |
| 7 | + |
| 8 | +#use soft tabs (spaces) for indentation |
| 9 | +indent_style = space |
| 10 | +indent_size = 4 |
| 11 | +tab_width = 4 |
| 12 | + |
| 13 | +#Formatting - new line options |
| 14 | + |
| 15 | +trim_trailing_whitespace = true |
| 16 | +insert_final_newline = true |
| 17 | +#require members of anonymous types to be on separate lines |
| 18 | +csharp_new_line_before_members_in_anonymous_types = true |
| 19 | + |
| 20 | +[*.cs] |
| 21 | + |
| 22 | +#place catch statements on a new line |
| 23 | +csharp_new_line_before_catch = true |
| 24 | +#place else statements on a new line |
| 25 | +csharp_new_line_before_else = true |
| 26 | +#require members of object initializers to be on the same line |
| 27 | +csharp_new_line_before_members_in_object_initializers = false |
| 28 | +#require braces to be on a new line for object_collection_array_initializers, accessors, types, control_blocks, methods, lambdas, and properties (also known as "Allman" style) |
| 29 | +csharp_new_line_before_open_brace = object_collection_array_initializers, accessors, types, control_blocks, methods, lambdas, properties |
| 30 | + |
| 31 | +#Formatting - organize using options |
| 32 | + |
| 33 | +#sort System.* using directives alphabetically, and place them before other usings |
| 34 | +dotnet_sort_system_directives_first = true |
| 35 | + |
| 36 | +#Formatting - spacing options |
| 37 | + |
| 38 | +#require a space between a cast and the value |
| 39 | +csharp_space_after_cast = true |
| 40 | +#require a space before the colon for bases or interfaces in a type declaration |
| 41 | +csharp_space_after_colon_in_inheritance_clause = true |
| 42 | +#require a space after a keyword in a control flow statement such as a for loop |
| 43 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 44 | +#require a space before the colon for bases or interfaces in a type declaration |
| 45 | +csharp_space_before_colon_in_inheritance_clause = true |
| 46 | +#remove space within empty argument list parentheses |
| 47 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 48 | +#remove space between method call name and opening parenthesis |
| 49 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 50 | +#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call |
| 51 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 52 | +#remove space within empty parameter list parentheses for a method declaration |
| 53 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 54 | +#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. |
| 55 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 56 | +#use space after cast and colon and comma and dot and semicolon |
| 57 | +csharp_space_after_cast = true |
| 58 | +csharp_space_after_colon_in_inheritance_clause = true |
| 59 | +csharp_space_after_colon_for_base_or_interface_in_type_declaration = true |
| 60 | +csharp_space_before_comma = false |
| 61 | +csharp_space_after_comma = true |
| 62 | +csharp_space_after_dot = false |
| 63 | +csharp_space_before_dot = false |
| 64 | +csharp_space_after_semicolon_in_for_statement = true |
| 65 | +csharp_space_before_semicolon_in_for_statement = false |
| 66 | +# use space between brackets |
| 67 | +csharp_space_between_empty_square_brackets = false |
| 68 | +csharp_space_between_square_brackets = false |
| 69 | +# use space before brackets |
| 70 | +csharp_space_before_open_square_brackets = false |
| 71 | + |
| 72 | +#Formatting - wrapping options |
| 73 | + |
| 74 | +#leave code block on single line |
| 75 | +csharp_preserve_single_line_blocks = true |
| 76 | +#leave statements and member declarations on the same line |
| 77 | +csharp_preserve_single_line_statements = true |
| 78 | + |
| 79 | +#Style - Code block preferences |
| 80 | + |
| 81 | +#prefer no curly braces if allowed |
| 82 | +csharp_prefer_braces = false:suggestion |
| 83 | + |
| 84 | +#Style - expression bodied member options |
| 85 | + |
| 86 | +#prefer block bodies for accessors |
| 87 | +csharp_style_expression_bodied_accessors = false:suggestion |
| 88 | +#prefer block bodies for constructors |
| 89 | +csharp_style_expression_bodied_constructors = false:suggestion |
| 90 | +#prefer block bodies for methods |
| 91 | +csharp_style_expression_bodied_methods = false:suggestion |
| 92 | +#prefer expression-bodied members for properties when they will be a single line |
| 93 | +csharp_style_expression_bodied_properties = when_on_single_line:suggestion |
| 94 | + |
| 95 | +#Style - expression level options |
| 96 | + |
| 97 | +#prefer out variables to be declared inline in the argument list of a method call when possible |
| 98 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 99 | +#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them |
| 100 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 101 | + |
| 102 | +#Style - Expression-level preferences |
| 103 | + |
| 104 | +#prefer objects to be initialized using object initializers when possible |
| 105 | +dotnet_style_object_initializer = true:suggestion |
| 106 | + |
| 107 | +#Style - implicit and explicit types |
| 108 | + |
| 109 | +#prefer var over explicit type in all cases, unless overridden by another code style rule |
| 110 | +csharp_style_var_elsewhere = true:suggestion |
| 111 | +#prefer var is used to declare variables with built-in system types such as int |
| 112 | +csharp_style_var_for_built_in_types = true:suggestion |
| 113 | +#prefer var when the type is already mentioned on the right-hand side of a declaration expression |
| 114 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 115 | + |
| 116 | +#Style - language keyword and framework type options |
| 117 | + |
| 118 | +#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them |
| 119 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 120 | + |
| 121 | +#Style - modifier options |
| 122 | + |
| 123 | +#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods. |
| 124 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion |
| 125 | + |
| 126 | +#Style - Modifier preferences |
| 127 | + |
| 128 | +#when this rule is set to a list of modifiers, prefer the specified ordering. |
| 129 | +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion |
| 130 | + |
| 131 | +#Style - Pattern matching |
| 132 | + |
| 133 | +#prefer pattern matching instead of is expression with type casts |
| 134 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 135 | + |
| 136 | +#Style - qualification options |
| 137 | + |
| 138 | +#prefer events not to be prefaced with this. or Me. in Visual Basic |
| 139 | +dotnet_style_qualification_for_event = false:suggestion |
| 140 | +#prefer fields not to be prefaced with this. or Me. in Visual Basic |
| 141 | +dotnet_style_qualification_for_field = false:suggestion |
| 142 | +#prefer methods not to be prefaced with this. or Me. in Visual Basic |
| 143 | +dotnet_style_qualification_for_method = false:suggestion |
| 144 | +#prefer properties not to be prefaced with this. or Me. in Visual Basic |
| 145 | +dotnet_style_qualification_for_property = false:suggestion |
| 146 | + |
| 147 | +csharp_indent_labels = one_less_than_current |
| 148 | +csharp_using_directive_placement = outside_namespace:silent |
| 149 | +csharp_prefer_simple_using_statement = true:suggestion |
| 150 | +csharp_style_namespace_declarations = block_scoped:silent |
| 151 | +csharp_style_expression_bodied_operators = false:silent |
| 152 | +csharp_style_expression_bodied_indexers = true:silent |
| 153 | +csharp_style_expression_bodied_lambdas = true:silent |
| 154 | +csharp_style_expression_bodied_local_functions = false:silent |
| 155 | +csharp_new_line_before_finally = true |
| 156 | +csharp_space_around_binary_operators = before_and_after |
| 157 | +csharp_space_between_parentheses = false |
| 158 | +csharp_style_throw_expression = true:suggestion |
| 159 | +csharp_style_prefer_null_check_over_type_check = true:suggestion |
| 160 | +csharp_prefer_simple_default_expression = true:suggestion |
| 161 | +csharp_style_prefer_local_over_anonymous_function = true:suggestion |
| 162 | +csharp_style_prefer_index_operator = true:suggestion |
| 163 | +csharp_style_prefer_range_operator = true:suggestion |
| 164 | +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion |
| 165 | +csharp_style_prefer_tuple_swap = true:suggestion |
| 166 | +csharp_style_deconstructed_variable_declaration = true:suggestion |
| 167 | +csharp_style_unused_value_assignment_preference = discard_variable:suggestion |
| 168 | +csharp_style_unused_value_expression_statement_preference = discard_variable:silent |
| 169 | +csharp_prefer_static_local_function = true:suggestion |
| 170 | +csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent |
| 171 | +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent |
| 172 | +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent |
| 173 | +csharp_style_conditional_delegate_call = true:suggestion |
| 174 | +csharp_style_prefer_switch_expression = true:suggestion |
| 175 | +csharp_style_prefer_pattern_matching = true:silent |
| 176 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 177 | +csharp_style_prefer_not_pattern = true:suggestion |
| 178 | +csharp_style_prefer_extended_property_pattern = true:suggestion |
| 179 | + |
| 180 | +[*.{cs,vb}] |
| 181 | +dotnet_style_operator_placement_when_wrapping = beginning_of_line |
| 182 | +tab_width = 4 |
| 183 | +indent_size = 4 |
| 184 | +end_of_line = crlf |
| 185 | +dotnet_style_coalesce_expression = true:suggestion |
| 186 | +dotnet_style_null_propagation = true:suggestion |
| 187 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion |
| 188 | +dotnet_style_prefer_auto_properties = true:silent |
| 189 | +dotnet_style_object_initializer = true:suggestion |
| 190 | +dotnet_style_collection_initializer = true:suggestion |
| 191 | +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion |
| 192 | +dotnet_style_prefer_conditional_expression_over_assignment = true:silent |
| 193 | +dotnet_style_prefer_conditional_expression_over_return = true:silent |
| 194 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 195 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 196 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 197 | +dotnet_style_prefer_compound_assignment = true:suggestion |
| 198 | +dotnet_style_prefer_simplified_interpolation = true:suggestion |
| 199 | +[*.{cs,vb}] |
| 200 | +#### Naming styles #### |
| 201 | + |
| 202 | +# Naming rules |
| 203 | + |
| 204 | +dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning |
| 205 | +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface |
| 206 | +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i |
| 207 | + |
| 208 | +dotnet_naming_rule.types_should_be_pascal_case.severity = warning |
| 209 | +dotnet_naming_rule.types_should_be_pascal_case.symbols = types |
| 210 | +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case |
| 211 | + |
| 212 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning |
| 213 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members |
| 214 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case |
| 215 | + |
| 216 | +# Symbol specifications |
| 217 | + |
| 218 | +dotnet_naming_symbols.interface.applicable_kinds = interface |
| 219 | +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 220 | +dotnet_naming_symbols.interface.required_modifiers = |
| 221 | + |
| 222 | +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum |
| 223 | +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 224 | +dotnet_naming_symbols.types.required_modifiers = |
| 225 | + |
| 226 | +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method |
| 227 | +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 228 | +dotnet_naming_symbols.non_field_members.required_modifiers = |
| 229 | + |
| 230 | +# Naming styles |
| 231 | + |
| 232 | +dotnet_naming_style.begins_with_i.required_prefix = I |
| 233 | +dotnet_naming_style.begins_with_i.required_suffix = |
| 234 | +dotnet_naming_style.begins_with_i.word_separator = |
| 235 | +dotnet_naming_style.begins_with_i.capitalization = pascal_case |
| 236 | + |
| 237 | +dotnet_naming_style.pascal_case.required_prefix = |
| 238 | +dotnet_naming_style.pascal_case.required_suffix = |
| 239 | +dotnet_naming_style.pascal_case.word_separator = |
| 240 | +dotnet_naming_style.pascal_case.capitalization = pascal_case |
| 241 | + |
| 242 | +dotnet_naming_style.pascal_case.required_prefix = |
| 243 | +dotnet_naming_style.pascal_case.required_suffix = |
| 244 | +dotnet_naming_style.pascal_case.word_separator = |
| 245 | +dotnet_naming_style.pascal_case.capitalization = pascal_case |
| 246 | +dotnet_style_namespace_match_folder = true:suggestion |
| 247 | +dotnet_style_readonly_field = true:suggestion |
| 248 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 249 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 250 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion |
| 251 | +dotnet_style_allow_multiple_blank_lines_experimental = true:silent |
| 252 | +dotnet_style_allow_statement_immediately_after_block_experimental = true:silent |
| 253 | +dotnet_code_quality_unused_parameters = all:suggestion |
| 254 | +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent |
| 255 | +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent |
| 256 | +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent |
| 257 | +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent |
| 258 | +dotnet_style_qualification_for_field = false:suggestion |
| 259 | +dotnet_style_qualification_for_property = false:suggestion |
| 260 | +dotnet_style_qualification_for_method = false:suggestion |
| 261 | +dotnet_style_qualification_for_event = false:suggestion |
0 commit comments