|
| 1 | +# http://editorconfig.org/ |
| 2 | + |
| 3 | +root = true |
| 4 | + |
| 5 | +[*] |
| 6 | +indent_style = tab |
| 7 | +insert_final_newline = true |
| 8 | +tab_width = 4 |
| 9 | +indent_size = 4 |
| 10 | +charset = utf-8 |
| 11 | + |
| 12 | + |
| 13 | +### Naming rules: ### |
| 14 | + |
| 15 | +# Constants are PascalCase |
| 16 | +dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion |
| 17 | +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants |
| 18 | +dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style |
| 19 | + |
| 20 | +dotnet_naming_symbols.constants.applicable_kinds = field, local |
| 21 | +dotnet_naming_symbols.constants.required_modifiers = const |
| 22 | + |
| 23 | +dotnet_naming_style.constant_style.capitalization = pascal_case |
| 24 | + |
| 25 | +# Non-private readonly fields are PascalCase |
| 26 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion |
| 27 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields |
| 28 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style |
| 29 | + |
| 30 | +dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field |
| 31 | +dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected |
| 32 | +dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly |
| 33 | + |
| 34 | +dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case |
| 35 | + |
| 36 | +# Non-private static fields are PascalCase |
| 37 | +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion |
| 38 | +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields |
| 39 | +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style |
| 40 | + |
| 41 | +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field |
| 42 | +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected |
| 43 | +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static |
| 44 | + |
| 45 | +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case |
| 46 | + |
| 47 | +# Static fields are s_camelCase |
| 48 | +dotnet_naming_rule.static_fields_should_be_pascal_case.severity = suggestion |
| 49 | +dotnet_naming_rule.static_fields_should_be_pascal_case.symbols = static_fields |
| 50 | +dotnet_naming_rule.static_fields_should_be_pascal_case.style = static_field_style |
| 51 | + |
| 52 | +dotnet_naming_symbols.static_fields.applicable_kinds = field |
| 53 | +dotnet_naming_symbols.static_fields.required_modifiers = static |
| 54 | + |
| 55 | +dotnet_naming_style.static_field_style.capitalization = camel_case |
| 56 | +dotnet_naming_style.static_field_style.required_prefix = s_ |
| 57 | + |
| 58 | +# Instance fields are camelCase and start with _ |
| 59 | +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion |
| 60 | +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields |
| 61 | +dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style |
| 62 | + |
| 63 | +dotnet_naming_symbols.instance_fields.applicable_kinds = field |
| 64 | + |
| 65 | +dotnet_naming_style.instance_field_style.capitalization = camel_case |
| 66 | +dotnet_naming_style.instance_field_style.required_prefix = _ |
| 67 | + |
| 68 | +# Locals and parameters are camelCase |
| 69 | +dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion |
| 70 | +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters |
| 71 | +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style |
| 72 | + |
| 73 | +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local |
| 74 | + |
| 75 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 76 | + |
| 77 | +# Local functions are PascalCase |
| 78 | +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion |
| 79 | +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions |
| 80 | +dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style |
| 81 | + |
| 82 | +dotnet_naming_symbols.local_functions.applicable_kinds = local_function |
| 83 | + |
| 84 | +dotnet_naming_style.local_function_style.capitalization = pascal_case |
| 85 | + |
| 86 | +# By default, name items with PascalCase |
| 87 | +dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion |
| 88 | +dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members |
| 89 | +dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style |
| 90 | + |
| 91 | +dotnet_naming_symbols.all_members.applicable_kinds = * |
| 92 | + |
| 93 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 94 | + |
| 95 | + |
| 96 | +### Dotnet code style settings: ### |
| 97 | + |
| 98 | +# Sort using and Import directives with System.* appearing first |
| 99 | +dotnet_sort_system_directives_first = true |
| 100 | +dotnet_separate_import_directive_groups = false |
| 101 | + |
| 102 | +# require accessibility modifiers |
| 103 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:error |
| 104 | + |
| 105 | +# Avoid "this." and "Me." if not necessary |
| 106 | +dotnet_style_qualification_for_field = false:refactoring |
| 107 | +dotnet_style_qualification_for_property = false:refactoring |
| 108 | +dotnet_style_qualification_for_method = false:refactoring |
| 109 | +dotnet_style_qualification_for_event = false:refactoring |
| 110 | + |
| 111 | +# Use language keywords instead of framework type names for type references |
| 112 | +dotnet_style_predefined_type_for_locals_parameters_members = true:error |
| 113 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 114 | + |
| 115 | +# Initializers |
| 116 | +dotnet_style_object_initializer = true:suggestion |
| 117 | +dotnet_style_collection_initializer = true:suggestion |
| 118 | +dotnet_style_prefer_collection_expression = when_types_loosely_match:warning |
| 119 | + |
| 120 | +# Null checks |
| 121 | +dotnet_style_coalesce_expression = true:suggestion |
| 122 | +dotnet_style_null_propagation = true:suggestion |
| 123 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning |
| 124 | + |
| 125 | +# Tuple Naming |
| 126 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 127 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 128 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 129 | + |
| 130 | +# Assignments |
| 131 | +dotnet_style_prefer_conditional_expression_over_assignment = true:error |
| 132 | +dotnet_style_prefer_conditional_expression_over_return = true:none |
| 133 | +dotnet_style_prefer_compound_assignment = true:warning |
| 134 | + |
| 135 | +# Parenthesis |
| 136 | +dotnet_code_quality_unused_parameters = all:suggestion |
| 137 | +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion |
| 138 | +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion |
| 139 | +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion |
| 140 | +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion |
| 141 | + |
| 142 | +# Miscellaneous |
| 143 | +dotnet_style_prefer_auto_properties = true:warning |
| 144 | +dotnet_style_prefer_simplified_boolean_expressions = true:warning |
| 145 | +dotnet_style_prefer_simplified_interpolation = true:warning |
| 146 | +dotnet_style_namespace_match_folder = true:warning |
| 147 | +dotnet_style_operator_placement_when_wrapping = beginning_of_line |
| 148 | +dotnet_style_readonly_field = true:warning |
| 149 | + |
| 150 | +# New-line preferences |
| 151 | +dotnet_style_allow_multiple_blank_lines_experimental = false:warning |
| 152 | +dotnet_style_allow_statement_immediately_after_block_experimental = false:warning |
| 153 | +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false:warning |
| 154 | +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false:warning |
| 155 | + |
| 156 | +# Build scripts |
| 157 | +[*.{yml,yaml}] |
| 158 | +indent_style = spaces |
| 159 | +indent_size = 2 |
| 160 | + |
| 161 | +# XML project files |
| 162 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] |
| 163 | +indent_size = 2 |
| 164 | + |
| 165 | +# Code files |
| 166 | +[*.cs] |
| 167 | + |
| 168 | +## C# style settings: |
| 169 | + |
| 170 | +# Newline settings |
| 171 | +csharp_new_line_before_open_brace = all |
| 172 | +csharp_new_line_before_else = true |
| 173 | +csharp_new_line_before_catch = true |
| 174 | +csharp_new_line_before_finally = true |
| 175 | +csharp_new_line_before_members_in_object_initializers = true |
| 176 | +csharp_new_line_before_members_in_anonymous_types = true |
| 177 | +csharp_new_line_between_query_expression_clauses = true |
| 178 | + |
| 179 | +# Indentation preferences |
| 180 | +csharp_indent_block_contents = true |
| 181 | +csharp_indent_braces = false |
| 182 | +csharp_indent_case_contents = true |
| 183 | +csharp_indent_case_contents_when_block = false |
| 184 | +csharp_indent_switch_labels = true |
| 185 | +csharp_indent_labels = flush_left |
| 186 | + |
| 187 | +# Prefer "var" everywhere |
| 188 | +csharp_style_var_for_built_in_types = true:suggestion |
| 189 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 190 | +csharp_style_var_elsewhere = true:suggestion |
| 191 | + |
| 192 | +# Prefer method-like constructs to have a block body |
| 193 | +csharp_style_expression_bodied_methods = false:none |
| 194 | +csharp_style_expression_bodied_constructors = false:none |
| 195 | +csharp_style_expression_bodied_operators = false:none |
| 196 | + |
| 197 | +# Prefer local method constructs to have a block body |
| 198 | +csharp_style_expression_bodied_local_functions = true:suggestion |
| 199 | + |
| 200 | +# Prefer property-like constructs to have an expression-body |
| 201 | +csharp_style_expression_bodied_properties = true:suggestion |
| 202 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 203 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 204 | + |
| 205 | +# Space preferences |
| 206 | +csharp_space_after_cast = false |
| 207 | +csharp_space_after_colon_in_inheritance_clause = true |
| 208 | +csharp_space_after_comma = true |
| 209 | +csharp_space_after_dot = false |
| 210 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 211 | +csharp_space_after_semicolon_in_for_statement = true |
| 212 | +csharp_space_around_binary_operators = before_and_after |
| 213 | +csharp_space_around_declaration_statements = do_not_ignore |
| 214 | +csharp_space_before_colon_in_inheritance_clause = true |
| 215 | +csharp_space_before_comma = false |
| 216 | +csharp_space_before_dot = false |
| 217 | +csharp_space_before_open_square_brackets = false |
| 218 | +csharp_space_before_semicolon_in_for_statement = false |
| 219 | +csharp_space_between_empty_square_brackets = false |
| 220 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 221 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 222 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 223 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 224 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 225 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 226 | +csharp_space_between_parentheses = false |
| 227 | +csharp_space_between_square_brackets = false |
| 228 | + |
| 229 | +# Blocks are allowed |
| 230 | +csharp_prefer_braces = when_multiline:silent |
| 231 | +csharp_preserve_single_line_blocks = true:silent |
| 232 | +csharp_preserve_single_line_statements = true:silent |
| 233 | + |
| 234 | +# Pattern Matching |
| 235 | +csharp_style_prefer_pattern_matching = true:warning |
| 236 | +csharp_style_prefer_not_pattern = true:warning |
| 237 | +csharp_style_prefer_extended_property_pattern = true:warning |
| 238 | +csharp_style_pattern_matching_over_as_with_null_check = true:warning |
| 239 | +csharp_style_pattern_matching_over_is_with_cast_check = true:warning |
| 240 | + |
| 241 | +# Namespace |
| 242 | +csharp_style_namespace_declarations = file_scoped:error |
| 243 | +csharp_using_directive_placement = outside_namespace:warning |
| 244 | + |
| 245 | +# Suggest more modern language features when available |
| 246 | +csharp_prefer_simple_default_expression = true:warning |
| 247 | +csharp_prefer_simple_using_statement = true:suggestion |
| 248 | +csharp_prefer_static_local_function = true:suggestion |
| 249 | +csharp_style_conditional_delegate_call = true:warning |
| 250 | +csharp_style_deconstructed_variable_declaration = true:warning |
| 251 | +csharp_style_expression_bodied_lambdas = true:suggestion |
| 252 | +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion |
| 253 | +csharp_style_inlined_variable_declaration = true:warning |
| 254 | +csharp_style_prefer_index_operator = true:suggestion |
| 255 | +csharp_style_prefer_local_over_anonymous_function = true:suggestion |
| 256 | +csharp_style_prefer_method_group_conversion = true:silent |
| 257 | +csharp_style_prefer_null_check_over_type_check = true:suggestion |
| 258 | +csharp_style_prefer_primary_constructors = true:warning |
| 259 | +csharp_style_prefer_range_operator = true:suggestion |
| 260 | +csharp_style_prefer_readonly_struct = true:suggestion |
| 261 | +csharp_style_prefer_readonly_struct_member = true:suggestion |
| 262 | +csharp_style_prefer_switch_expression = true:warning |
| 263 | +csharp_style_prefer_top_level_statements = true:silent |
| 264 | +csharp_style_prefer_tuple_swap = true:suggestion |
| 265 | +csharp_style_prefer_utf8_string_literals = true:suggestion |
| 266 | +csharp_style_throw_expression = true:warning |
| 267 | +csharp_style_unused_value_assignment_preference = discard_variable:warning |
| 268 | +csharp_style_unused_value_expression_statement_preference = discard_variable:warning |
| 269 | + |
| 270 | +# New Lines |
| 271 | +csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent |
| 272 | +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent |
| 273 | +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent |
| 274 | +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent |
| 275 | +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent |
| 276 | + |
| 277 | +# Style Analytics |
| 278 | +dotnet_analyzer_diagnostic.category-Style.severity = warning |
| 279 | + |
| 280 | +# XML Documentation |
| 281 | +dotnet_diagnostic.CS0105.severity = error # CS0105: Using directive is unnecessary. |
| 282 | +dotnet_diagnostic.CS1573.severity = error # CS1573: Missing XML comment for parameter |
| 283 | +dotnet_diagnostic.CS1591.severity = error # CS1591: Missing XML comment for publicly visible type or member |
| 284 | +dotnet_diagnostic.CS1712.severity = error # CS1712: Type parameter has no matching typeparam tag in the XML comment (but other type parameters do) |
| 285 | + |
| 286 | +# Async |
| 287 | +dotnet_diagnostic.CS1998.severity = error # CS1998: Async method lacks 'await' operators and will run synchronously |
| 288 | +dotnet_diagnostic.CS4014.severity = error # CS4014: Because this call is not awaited, execution of the current method continues before the call is completed |
| 289 | +dotnet_diagnostic.CA2007.severity = none # CA2007: Consider calling ConfigureAwait on the awaited task |
| 290 | + |
| 291 | +# Immediate.Handlers relies on nested types |
| 292 | +dotnet_diagnostic.CA1034.severity = none # CA1034: Nested types should not be visible |
| 293 | + |
| 294 | +# No need for cryptographically secure anything in this project |
| 295 | +dotnet_diagnostic.CA5394.severity = none # CA5394: Random is an insecure random number generator |
| 296 | + |
| 297 | +# Dispose things need disposing |
| 298 | +dotnet_diagnostic.CA2000.severity = error # CA2000: Dispose objects before losing scope |
| 299 | + |
| 300 | +dotnet_diagnostic.CA1515.severity = none # CA1515: Consider making public types internal |
0 commit comments