|
| 1 | +# Suppress: EC102 EC116 |
| 2 | +; EditorConfig to support per-solution formatting. |
| 3 | +; Use the EditorConfig VS add-in to make this work for VS2015 and under. |
| 4 | +; http://editorconfig.org/ |
| 5 | + |
| 6 | +root = true |
| 7 | + |
| 8 | +[*] |
| 9 | +indent_style = tab |
| 10 | +indent_size = 4 |
| 11 | +charset = utf-8-bom |
| 12 | +insert_final_newline = true |
| 13 | +trim_trailing_whitespace = true |
| 14 | +end_of_line = crlf |
| 15 | + |
| 16 | +# Dotnet code style settings: |
| 17 | +[*.cs] |
| 18 | +# Sort using and Import directives with System.* appearing first |
| 19 | +dotnet_sort_system_directives_first = true |
| 20 | + |
| 21 | +# require access modifiers |
| 22 | +dotnet_style_require_accessibility_modifiers = always:error |
| 23 | + |
| 24 | +# require explicit member names for anonymous types |
| 25 | +dotnet_style_prefer_inferred_anonymous_type_member_names = false:error |
| 26 | + |
| 27 | +# Avoid "this." and "Me." if not necessary |
| 28 | +dotnet_style_qualification_for_field = false:error |
| 29 | +dotnet_style_qualification_for_property = false:error |
| 30 | +dotnet_style_qualification_for_method = false:error |
| 31 | +dotnet_style_qualification_for_event = false:error |
| 32 | + |
| 33 | +# Use language keywords instead of framework type names for type references |
| 34 | +dotnet_style_predefined_type_for_locals_parameters_members = true:error |
| 35 | +dotnet_style_predefined_type_for_member_access = false:error |
| 36 | + |
| 37 | +# Suggest more modern language features when available |
| 38 | +dotnet_style_object_initializer = true:error |
| 39 | +dotnet_style_collection_initializer = true:error |
| 40 | +dotnet_style_coalesce_expression = true:error |
| 41 | +dotnet_style_null_propagation = true:error |
| 42 | +dotnet_style_explicit_tuple_names = true:error |
| 43 | + |
| 44 | +# CSharp code style settings: |
| 45 | +[*.cs] |
| 46 | +# Prefer "var" everywhere |
| 47 | +csharp_style_var_for_built_in_types = true:error |
| 48 | +csharp_style_var_when_type_is_apparent = true:error |
| 49 | +csharp_style_var_elsewhere = true:error |
| 50 | + |
| 51 | +# Prefer method-like constructs to have a block body |
| 52 | +csharp_style_expression_bodied_methods = false:error |
| 53 | +csharp_style_expression_bodied_constructors = false:error |
| 54 | +csharp_style_expression_bodied_operators = false:error |
| 55 | + |
| 56 | +# Prefer property-like constructs to have an expression-body |
| 57 | +csharp_style_expression_bodied_properties = true:error |
| 58 | +csharp_style_expression_bodied_indexers = true:error |
| 59 | +csharp_style_expression_bodied_accessors = true:error |
| 60 | + |
| 61 | +# Suggest more modern language features when available |
| 62 | +csharp_style_pattern_matching_over_is_with_cast_check = true:error |
| 63 | +csharp_style_pattern_matching_over_as_with_null_check = true:error |
| 64 | +csharp_style_inlined_variable_declaration = false:error |
| 65 | +csharp_style_throw_expression = true:error |
| 66 | +csharp_style_conditional_delegate_call = true:error |
| 67 | + |
| 68 | +# Newline settings |
| 69 | +csharp_new_line_before_open_brace = all |
| 70 | +csharp_new_line_before_else = true |
| 71 | +csharp_new_line_before_catch = true |
| 72 | +csharp_new_line_before_finally = true |
| 73 | +csharp_new_line_before_members_in_object_initializers = true |
| 74 | +csharp_new_line_before_members_in_anonymous_types = true |
| 75 | +csharp_new_line_between_query_expression_clauses = true |
| 76 | + |
| 77 | +# Indentation |
| 78 | +csharp_indent_case_contents = true |
| 79 | +csharp_indent_switch_labels = true |
| 80 | + |
| 81 | +# Expression preferences |
| 82 | +csharp_prefer_simple_default_expression = false:error |
| 83 | +csharp_style_deconstructed_variable_declaration = false:error |
| 84 | +csharp_style_pattern_local_over_anonymous_function = false:error |
| 85 | + |
| 86 | +# Require Braces |
| 87 | +csharp_prefer_braces = true:error |
| 88 | + |
| 89 | +# Spacing |
| 90 | +csharp_space_after_cast = true |
| 91 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 92 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 93 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 94 | + |
| 95 | +# Wrapping Options |
| 96 | +csharp_preserve_single_line_statements = false |
| 97 | +csharp_preserve_single_line_blocks = true |
| 98 | + |
| 99 | +# Naming conventions |
| 100 | +[*cs] |
| 101 | +# Anything public must be Pascal Case |
| 102 | +dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols |
| 103 | +dotnet_naming_symbols.public_symbols.applicable_kinds = class, struct, enum, property, method, field, event, delegate |
| 104 | +dotnet_naming_symbols.public_symbols.applicable_accessibilities = public |
| 105 | + |
| 106 | +dotnet_naming_rule.public_members_must_be_capitalized.style = first_word_upper_case_style |
| 107 | +dotnet_naming_style.first_word_upper_case_style.capitalization = pascal_case |
| 108 | + |
| 109 | +dotnet_naming_rule.public_members_must_be_capitalized.severity = error |
| 110 | + |
| 111 | +# Interfaces must start with I |
| 112 | +dotnet_naming_rule.interfaces_must_start_with_i.symbols = interfaces_symbols |
| 113 | +dotnet_naming_symbols.interfaces_symbols.applicable_kinds = interface |
| 114 | +dotnet_naming_symbols.interfaces_symbols.applicable_accessibilities = * |
| 115 | + |
| 116 | +dotnet_naming_rule.interfaces_must_start_with_i.style = interfaces_must_start_with_i_style |
| 117 | +dotnet_naming_style.interfaces_must_start_with_i_style.capitalization = pascal_case |
| 118 | +dotnet_naming_style.interfaces_must_start_with_i_style.required_prefix = I |
| 119 | + |
| 120 | +dotnet_naming_rule.interfaces_must_start_with_i.severity = error |
| 121 | + |
| 122 | +# Private variables must be underscored and lowercase |
| 123 | +dotnet_naming_rule.private_variables_must_be_underscored.symbols = private_fields |
| 124 | +dotnet_naming_symbols.private_fields.applicable_kinds = property, field |
| 125 | +dotnet_naming_symbols.private_fields.applicable_accessibilities = private |
| 126 | + |
| 127 | +dotnet_naming_rule.private_variables_must_be_underscored.style = private_underscore_camel_case |
| 128 | +dotnet_naming_style.private_underscore_camel_case.capitalization = camel_case |
| 129 | +dotnet_naming_style.private_underscore_camel_case.required_prefix = _ |
| 130 | + |
| 131 | +dotnet_naming_rule.private_variables_must_be_underscored.severity = error |
| 132 | + |
| 133 | +# Private members must be camel case |
| 134 | +dotnet_naming_rule.private_members_must_be_lowercase.symbols = private_members |
| 135 | +dotnet_naming_symbols.private_members.applicable_kinds = method |
| 136 | +dotnet_naming_symbols.private_members.applicable_accessibilities = private |
| 137 | + |
| 138 | +dotnet_naming_rule.private_members_must_be_lowercase.style = private_camel_case |
| 139 | +dotnet_naming_style.private_camel_case.capitalization = camel_case |
| 140 | + |
| 141 | +dotnet_naming_rule.private_members_must_be_lowercase.severity = error |
0 commit comments