|
| 1 | +# editorconfig.org |
| 2 | +root = true |
| 3 | + |
| 4 | +# All files |
| 5 | +[*] |
| 6 | +indent_style = tab |
| 7 | +indent_size = 4 |
| 8 | +tab_width = 4 |
| 9 | +end_of_line = crlf |
| 10 | +charset = utf-8 |
| 11 | +trim_trailing_whitespace = true |
| 12 | +insert_final_newline = true |
| 13 | + |
| 14 | +# XML files |
| 15 | +[*.{xml,csproj,props,targets,slnx}] |
| 16 | +indent_style = tab |
| 17 | +indent_size = 4 |
| 18 | +tab_width = 4 |
| 19 | + |
| 20 | +# JSON files |
| 21 | +[*.json] |
| 22 | +indent_style = tab |
| 23 | +indent_size = 4 |
| 24 | +tab_width = 4 |
| 25 | + |
| 26 | +# YAML files |
| 27 | +[*.{yml,yaml}] |
| 28 | +indent_style = space |
| 29 | +indent_size = 2 |
| 30 | + |
| 31 | +# Markdown files |
| 32 | +[*.md] |
| 33 | +trim_trailing_whitespace = false |
| 34 | + |
| 35 | +# C# files |
| 36 | +[*.cs] |
| 37 | + |
| 38 | +#### .NET Coding Conventions #### |
| 39 | + |
| 40 | +# Organize usings |
| 41 | +dotnet_sort_system_directives_first = true |
| 42 | +dotnet_separate_import_directive_groups = false |
| 43 | + |
| 44 | +# this. preferences |
| 45 | +dotnet_style_qualification_for_event = false:warning |
| 46 | +dotnet_style_qualification_for_field = false:warning |
| 47 | +dotnet_style_qualification_for_method = false:warning |
| 48 | +dotnet_style_qualification_for_property = false:warning |
| 49 | + |
| 50 | +# Language keywords vs BCL types |
| 51 | +dotnet_style_predefined_type_for_locals_parameters_members = true:warning |
| 52 | +dotnet_style_predefined_type_for_member_access = true:warning |
| 53 | + |
| 54 | +# Parentheses |
| 55 | +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent |
| 56 | +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent |
| 57 | +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent |
| 58 | +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent |
| 59 | + |
| 60 | +# Modifier preferences |
| 61 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:error |
| 62 | + |
| 63 | +# Expression-level preferences |
| 64 | +dotnet_style_coalesce_expression = true:warning |
| 65 | +dotnet_style_collection_initializer = true:warning |
| 66 | +dotnet_style_explicit_tuple_names = true:warning |
| 67 | +dotnet_style_null_propagation = true:warning |
| 68 | +dotnet_style_object_initializer = true:warning |
| 69 | +dotnet_style_prefer_auto_properties = true:warning |
| 70 | +dotnet_style_prefer_compound_assignment = true:warning |
| 71 | +dotnet_style_prefer_conditional_expression_over_assignment = true:silent |
| 72 | +dotnet_style_prefer_conditional_expression_over_return = true:silent |
| 73 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning |
| 74 | +dotnet_style_prefer_inferred_tuple_names = true:warning |
| 75 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning |
| 76 | +dotnet_style_prefer_simplified_boolean_expressions = true:warning |
| 77 | +dotnet_style_prefer_simplified_interpolation = true:warning |
| 78 | +dotnet_style_readonly_field = true:warning |
| 79 | + |
| 80 | +# Parameter preferences |
| 81 | +dotnet_code_quality_unused_parameters = all:warning |
| 82 | + |
| 83 | +#### C# Coding Conventions #### |
| 84 | + |
| 85 | +# var preferences |
| 86 | +csharp_style_var_elsewhere = false:silent |
| 87 | +csharp_style_var_for_built_in_types = false:silent |
| 88 | +csharp_style_var_when_type_is_apparent = true:silent |
| 89 | + |
| 90 | +# Expression-bodied members |
| 91 | +csharp_style_expression_bodied_accessors = true:warning |
| 92 | +csharp_style_expression_bodied_constructors = false:silent |
| 93 | +csharp_style_expression_bodied_indexers = true:warning |
| 94 | +csharp_style_expression_bodied_lambdas = true:warning |
| 95 | +csharp_style_expression_bodied_local_functions = false:silent |
| 96 | +csharp_style_expression_bodied_methods = when_on_single_line:silent |
| 97 | +csharp_style_expression_bodied_operators = when_on_single_line:silent |
| 98 | +csharp_style_expression_bodied_properties = true:warning |
| 99 | + |
| 100 | +# Pattern matching |
| 101 | +csharp_style_pattern_matching_over_as_with_null_check = true:warning |
| 102 | +csharp_style_pattern_matching_over_is_with_cast_check = true:warning |
| 103 | +csharp_style_prefer_not_pattern = true:warning |
| 104 | +csharp_style_prefer_pattern_matching = true:warning |
| 105 | +csharp_style_prefer_switch_expression = true:warning |
| 106 | + |
| 107 | +# Null-checking |
| 108 | +csharp_style_conditional_delegate_call = true:warning |
| 109 | +csharp_style_prefer_null_check_over_type_check = true:warning |
| 110 | + |
| 111 | +# Modifier preferences |
| 112 | +csharp_prefer_static_local_function = true:warning |
| 113 | +csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning |
| 114 | + |
| 115 | +# Code block preferences |
| 116 | +csharp_prefer_braces = true:warning |
| 117 | +csharp_prefer_simple_using_statement = true:warning |
| 118 | + |
| 119 | +# Expression-level preferences |
| 120 | +csharp_prefer_simple_default_expression = true:warning |
| 121 | +csharp_style_deconstructed_variable_declaration = true:warning |
| 122 | +csharp_style_implicit_object_creation_when_type_is_apparent = true:warning |
| 123 | +csharp_style_inlined_variable_declaration = true:warning |
| 124 | +csharp_style_prefer_index_operator = true:warning |
| 125 | +csharp_style_prefer_range_operator = true:warning |
| 126 | +csharp_style_throw_expression = true:warning |
| 127 | +csharp_style_unused_value_assignment_preference = discard_variable:warning |
| 128 | +csharp_style_unused_value_expression_statement_preference = discard_variable:silent |
| 129 | +csharp_style_prefer_local_over_anonymous_function = true:warning |
| 130 | +csharp_style_prefer_method_group_conversion = true:warning |
| 131 | +csharp_style_prefer_extended_property_pattern = true:warning |
| 132 | +csharp_style_prefer_top_level_statements = true:silent |
| 133 | + |
| 134 | +# Operator wrapping |
| 135 | +dotnet_style_operator_placement_when_wrapping = beginning_of_line |
| 136 | + |
| 137 | +# using directive placement |
| 138 | +csharp_using_directive_placement = outside_namespace:warning |
| 139 | + |
| 140 | +# Namespace preferences |
| 141 | +csharp_style_namespace_declarations = file_scoped:error |
| 142 | + |
| 143 | +#### C# Formatting Rules #### |
| 144 | + |
| 145 | +# New line preferences |
| 146 | +csharp_new_line_before_catch = true |
| 147 | +csharp_new_line_before_else = true |
| 148 | +csharp_new_line_before_finally = true |
| 149 | +csharp_new_line_before_members_in_anonymous_types = true |
| 150 | +csharp_new_line_before_members_in_object_initializers = true |
| 151 | +csharp_new_line_before_open_brace = all |
| 152 | +csharp_new_line_between_query_expression_clauses = true |
| 153 | + |
| 154 | +# Indentation |
| 155 | +csharp_indent_block_contents = true |
| 156 | +csharp_indent_braces = false |
| 157 | +csharp_indent_case_contents = true |
| 158 | +csharp_indent_case_contents_when_block = true |
| 159 | +csharp_indent_labels = one_less_than_current |
| 160 | +csharp_indent_switch_labels = true |
| 161 | + |
| 162 | +# Space preferences |
| 163 | +csharp_space_after_cast = false |
| 164 | +csharp_space_after_colon_in_inheritance_clause = true |
| 165 | +csharp_space_after_comma = true |
| 166 | +csharp_space_after_dot = false |
| 167 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 168 | +csharp_space_after_semicolon_in_for_statement = true |
| 169 | +csharp_space_around_binary_operators = before_and_after |
| 170 | +csharp_space_around_declaration_statements = false |
| 171 | +csharp_space_before_colon_in_inheritance_clause = true |
| 172 | +csharp_space_before_comma = false |
| 173 | +csharp_space_before_dot = false |
| 174 | +csharp_space_before_open_square_brackets = false |
| 175 | +csharp_space_before_semicolon_in_for_statement = false |
| 176 | +csharp_space_between_empty_square_brackets = false |
| 177 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 178 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 179 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 180 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 181 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 182 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 183 | +csharp_space_between_parentheses = false |
| 184 | +csharp_space_between_square_brackets = false |
| 185 | + |
| 186 | +# Wrapping preferences |
| 187 | +csharp_preserve_single_line_blocks = true |
| 188 | +csharp_preserve_single_line_statements = true |
| 189 | + |
| 190 | +#### Naming styles #### |
| 191 | + |
| 192 | +# Naming rules |
| 193 | + |
| 194 | +dotnet_naming_rule.interface_should_be_begins_with_i.severity = error |
| 195 | +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface |
| 196 | +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i |
| 197 | + |
| 198 | +dotnet_naming_rule.types_should_be_pascal_case.severity = error |
| 199 | +dotnet_naming_rule.types_should_be_pascal_case.symbols = types |
| 200 | +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case |
| 201 | + |
| 202 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error |
| 203 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members |
| 204 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case |
| 205 | + |
| 206 | +dotnet_naming_rule.private_or_internal_field_should_be_begins_with_underscore.severity = warning |
| 207 | +dotnet_naming_rule.private_or_internal_field_should_be_begins_with_underscore.symbols = private_or_internal_field |
| 208 | +dotnet_naming_rule.private_or_internal_field_should_be_begins_with_underscore.style = begins_with_underscore |
| 209 | + |
| 210 | +# Symbol specifications |
| 211 | + |
| 212 | +dotnet_naming_symbols.interface.applicable_kinds = interface |
| 213 | +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 214 | + |
| 215 | +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum |
| 216 | +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 217 | + |
| 218 | +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method |
| 219 | +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 220 | + |
| 221 | +dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field |
| 222 | +dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected |
| 223 | + |
| 224 | +# Naming styles |
| 225 | + |
| 226 | +dotnet_naming_style.pascal_case.capitalization = pascal_case |
| 227 | + |
| 228 | +dotnet_naming_style.begins_with_i.required_prefix = I |
| 229 | +dotnet_naming_style.begins_with_i.capitalization = pascal_case |
| 230 | + |
| 231 | +dotnet_naming_style.begins_with_underscore.required_prefix = _ |
| 232 | +dotnet_naming_style.begins_with_underscore.capitalization = camel_case |
| 233 | + |
| 234 | +#### Analyzers #### |
| 235 | + |
| 236 | +# CA1062: Validate arguments of public methods |
| 237 | +dotnet_diagnostic.CA1062.severity = none |
| 238 | + |
| 239 | +# CA1303: Do not pass literals as localized parameters |
| 240 | +dotnet_diagnostic.CA1303.severity = none |
| 241 | + |
| 242 | +# CA1812: Avoid uninstantiated internal classes (false positives with DI) |
| 243 | +dotnet_diagnostic.CA1812.severity = none |
| 244 | + |
| 245 | +# CA2007: Consider calling ConfigureAwait on the awaited task |
| 246 | +dotnet_diagnostic.CA2007.severity = warning |
| 247 | + |
| 248 | +# IDE0058: Expression value is never used |
| 249 | +dotnet_diagnostic.IDE0058.severity = none |
0 commit comments