|
| 1 | +; EditorConfig to support per-solution formatting. |
| 2 | +; Use the EditorConfig VS add-in to make this work. |
| 3 | +; http://editorconfig.org/ |
| 4 | + |
| 5 | +; This is the default for the codeline. |
| 6 | +root = true |
| 7 | + |
| 8 | +[*] |
| 9 | +; Don't use tabs for indentation. |
| 10 | +indent_style = space |
| 11 | +; (Please don't specify an indent_size here; that has too many unintended consequences.) |
| 12 | +charset = utf-8 |
| 13 | +trim_trailing_whitespace = true |
| 14 | +insert_final_newline = true |
| 15 | + |
| 16 | +# Spell checker configuration |
| 17 | +spelling_exclusion_path = spelling.dic |
| 18 | + |
| 19 | +; Code files |
| 20 | +[*.{cs}] |
| 21 | +indent_size = 4 |
| 22 | + |
| 23 | +; All XML-based file formats |
| 24 | +[*.{config,csproj,nuspec,props,resx,ruleset,targets,vsct,vsixmanifest,xaml,xml,vsmanproj,swixproj}] |
| 25 | +indent_size = 2 |
| 26 | + |
| 27 | +; JSON files |
| 28 | +[*.json] |
| 29 | +indent_size = 2 |
| 30 | + |
| 31 | +; PowerShell scripts |
| 32 | +[*.{ps1}] |
| 33 | +indent_size = 4 |
| 34 | + |
| 35 | +[*.{sh}] |
| 36 | +indent_size = 4 |
| 37 | + |
| 38 | +; Dotnet code style settings |
| 39 | +[*.{cs,vb}] |
| 40 | +; Sort using and Import directives with System.* appearing first |
| 41 | +dotnet_sort_system_directives_first = true |
| 42 | +dotnet_separate_import_directive_groups = false |
| 43 | + |
| 44 | +; IDE0003 Avoid "this." and "Me." if not necessary |
| 45 | +dotnet_style_qualification_for_field = false:warning |
| 46 | +dotnet_style_qualification_for_property = false:warning |
| 47 | +dotnet_style_qualification_for_method = false:warning |
| 48 | +dotnet_style_qualification_for_event = false:warning |
| 49 | + |
| 50 | +; IDE0012 Use language keywords instead of framework type names for type references |
| 51 | +dotnet_style_predefined_type_for_locals_parameters_members = true:warning |
| 52 | +; IDE0013 |
| 53 | +dotnet_style_predefined_type_for_member_access = true:warning |
| 54 | + |
| 55 | +; Suggest more modern language features when available |
| 56 | +dotnet_style_object_initializer = true:suggestion |
| 57 | +dotnet_style_collection_initializer = true:suggestion |
| 58 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 59 | +dotnet_style_coalesce_expression = true:suggestion |
| 60 | +dotnet_style_null_propagation = true:suggestion |
| 61 | + |
| 62 | +; CSharp code style settings |
| 63 | +[*.cs] |
| 64 | +; IDE0007 'var' preferences |
| 65 | +csharp_style_var_for_built_in_types = true:none |
| 66 | +csharp_style_var_when_type_is_apparent = true:none |
| 67 | +csharp_style_var_elsewhere = false:none |
| 68 | + |
| 69 | +; Prefer method-like constructs to have a block body |
| 70 | +csharp_style_expression_bodied_methods = false:none |
| 71 | +csharp_style_expression_bodied_constructors = false:none |
| 72 | +csharp_style_expression_bodied_operators = false:none |
| 73 | + |
| 74 | +; Prefer property-like constructs to have an expression-body |
| 75 | +csharp_style_expression_bodied_properties = true:suggestion |
| 76 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 77 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 78 | + |
| 79 | +; Suggest more modern language features when available |
| 80 | +csharp_style_pattern_matching_over_is_with_cast_check = true:none |
| 81 | +csharp_style_pattern_matching_over_as_with_null_check = true:none |
| 82 | +csharp_style_inlined_variable_declaration = true:none |
| 83 | +csharp_style_throw_expression = true:none |
| 84 | +csharp_style_conditional_delegate_call = true:suggestion |
| 85 | + |
| 86 | +; Newline settings |
| 87 | +csharp_new_line_before_open_brace = all |
| 88 | +csharp_new_line_before_else = true |
| 89 | +csharp_new_line_before_catch = true |
| 90 | +csharp_new_line_before_finally = true |
| 91 | +csharp_new_line_before_members_in_object_initializers = true |
| 92 | +csharp_new_line_before_members_in_anonymous_types = true |
| 93 | + |
| 94 | +; Naming styles |
| 95 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 96 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 97 | + |
| 98 | +; Naming rule: async methods end in Async |
| 99 | +dotnet_naming_style.async_method_style.capitalization = pascal_case |
| 100 | +dotnet_naming_style.async_method_style.required_suffix = Async |
| 101 | +dotnet_naming_symbols.async_method_symbols.applicable_kinds = method |
| 102 | +dotnet_naming_symbols.async_method_symbols.required_modifiers = async |
| 103 | +dotnet_naming_rule.async_methods_rule.severity = suggestion |
| 104 | +dotnet_naming_rule.async_methods_rule.symbols = async_method_symbols |
| 105 | +dotnet_naming_rule.async_methods_rule.style = async_method_style |
| 106 | + |
| 107 | +; Naming rule: Interfaces must be pascal-cased prefixed with I |
| 108 | +dotnet_naming_style.interface_style.capitalization = pascal_case |
| 109 | +dotnet_naming_style.interface_style.required_prefix = I |
| 110 | +dotnet_naming_symbols.interface_symbols.applicable_kinds = interface |
| 111 | +dotnet_naming_symbols.interface_symbols.applicable_accessibilities = * |
| 112 | +dotnet_naming_rule.interfaces_rule.severity = warning |
| 113 | +dotnet_naming_rule.interfaces_rule.symbols = interface_symbols |
| 114 | +dotnet_naming_rule.interfaces_rule.style = interface_style |
| 115 | + |
| 116 | +; Naming rule: All methods and properties must be pascal-cased |
| 117 | +dotnet_naming_symbols.method_and_property_symbols.applicable_kinds = method,property,class,struct,enum:property,namespace |
| 118 | +dotnet_naming_symbols.method_and_property_symbols.applicable_accessibilities = * |
| 119 | +dotnet_naming_rule.methods_and_properties_rule.severity = warning |
| 120 | +dotnet_naming_rule.methods_and_properties_rule.symbols = method_and_property_symbols |
| 121 | +dotnet_naming_rule.methods_and_properties_rule.style = pascal_case_style |
| 122 | + |
| 123 | +; Naming rule: Static fields must be pascal-cased |
| 124 | +dotnet_naming_symbols.static_member_symbols.applicable_kinds = field |
| 125 | +dotnet_naming_symbols.static_member_symbols.applicable_accessibilities = * |
| 126 | +dotnet_naming_symbols.static_member_symbols.required_modifiers = static |
| 127 | +dotnet_naming_symbols.const_member_symbols.applicable_kinds = field |
| 128 | +dotnet_naming_symbols.const_member_symbols.applicable_accessibilities = * |
| 129 | +dotnet_naming_symbols.const_member_symbols.required_modifiers = const |
| 130 | +dotnet_naming_rule.static_fields_rule.severity = warning |
| 131 | +dotnet_naming_rule.static_fields_rule.symbols = static_member_symbols |
| 132 | +dotnet_naming_rule.static_fields_rule.style = pascal_case_style |
| 133 | + |
| 134 | +; Naming rule: Private members must be camel-cased and prefixed with underscore |
| 135 | +dotnet_naming_style.private_member_style.capitalization = camel_case |
| 136 | +dotnet_naming_style.private_member_style.required_prefix = _ |
| 137 | +dotnet_naming_symbols.private_field_symbols.applicable_kinds = field,event |
| 138 | +dotnet_naming_symbols.private_field_symbols.applicable_accessibilities = private,protected,internal |
| 139 | +dotnet_naming_rule.private_field_rule.severity = warning |
| 140 | +dotnet_naming_rule.private_field_rule.symbols = private_field_symbols |
| 141 | +dotnet_naming_rule.private_field_rule.style = private_member_style |
| 142 | + |
| 143 | +; Diagnostics rule: Don't leave unnecessary suppressions |
| 144 | +dotnet_diagnostic.IDE0076.severity = warning |
| 145 | +dotnet_diagnostic.IDE0005.severity = warning |
0 commit comments