|
| 1 | +# You can modify the rules from these initially generated values to suit your own policies |
| 2 | +# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference |
| 3 | + |
| 4 | +############################### |
| 5 | +# Core EditorConfig Options # |
| 6 | +############################### |
| 7 | +root = true |
| 8 | +# All files |
| 9 | +[*] |
| 10 | +indent_style = space |
| 11 | + |
| 12 | +# XML project files |
| 13 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] |
| 14 | +indent_size = 2 |
| 15 | + |
| 16 | +# XML config files |
| 17 | +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] |
| 18 | +indent_size = 2 |
| 19 | + |
| 20 | +[*.cs] |
| 21 | +#Core editorconfig formatting - indentation |
| 22 | + |
| 23 | +#use soft tabs (spaces) for indentation |
| 24 | +indent_style = space |
| 25 | + |
| 26 | +#Formatting - indentation options |
| 27 | + |
| 28 | +#indent switch case contents. |
| 29 | +csharp_indent_case_contents = true |
| 30 | +#indent switch labels |
| 31 | +csharp_indent_switch_labels = true |
| 32 | + |
| 33 | +#Formatting - new line options |
| 34 | + |
| 35 | +#place catch statements on a new line |
| 36 | +csharp_new_line_before_catch = true |
| 37 | +#place else statements on a new line |
| 38 | +csharp_new_line_before_else = true |
| 39 | +#require members of object initializers to be on the same line |
| 40 | +csharp_new_line_before_members_in_object_initializers = false |
| 41 | +#require braces to be on a new line for object_collection_array_initializers, accessors, methods, properties, control_blocks, types, and lambdas (also known as "Allman" style) |
| 42 | +csharp_new_line_before_open_brace = object_collection_array_initializers, accessors, methods, properties, control_blocks, types, lambdas |
| 43 | + |
| 44 | +#Formatting - organize using options |
| 45 | + |
| 46 | +#do not place System.* using directives before other using directives |
| 47 | +dotnet_sort_system_directives_first = false |
| 48 | + |
| 49 | +#Formatting - spacing options |
| 50 | + |
| 51 | +#require NO space between a cast and the value |
| 52 | +csharp_space_after_cast = false |
| 53 | +#require a space before the colon for bases or interfaces in a type declaration |
| 54 | +csharp_space_after_colon_in_inheritance_clause = true |
| 55 | +#require a space after a keyword in a control flow statement such as a for loop |
| 56 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 57 | +#require a space before the colon for bases or interfaces in a type declaration |
| 58 | +csharp_space_before_colon_in_inheritance_clause = true |
| 59 | +#remove space within empty argument list parentheses |
| 60 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 61 | +#remove space between method call name and opening parenthesis |
| 62 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 63 | +#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call |
| 64 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 65 | +#remove space within empty parameter list parentheses for a method declaration |
| 66 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 67 | +#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. |
| 68 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 69 | + |
| 70 | +#Formatting - wrapping options |
| 71 | + |
| 72 | +#leave code block on single line |
| 73 | +csharp_preserve_single_line_blocks = true |
| 74 | +#leave statements and member declarations on the same line |
| 75 | +csharp_preserve_single_line_statements = true |
| 76 | + |
| 77 | +#Style - Code block preferences |
| 78 | + |
| 79 | +#prefer curly braces even for one line of code |
| 80 | +csharp_prefer_braces = true:suggestion |
| 81 | + |
| 82 | +#Style - expression bodied member options |
| 83 | + |
| 84 | +#prefer expression-bodied members for accessors |
| 85 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 86 | +#prefer expression-bodied members for constructors |
| 87 | +csharp_style_expression_bodied_constructors = true:suggestion |
| 88 | +#prefer expression-bodied members for indexers |
| 89 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 90 | +#prefer expression-bodied members for methods |
| 91 | +csharp_style_expression_bodied_methods = true:suggestion |
| 92 | +#prefer expression-bodied members for properties |
| 93 | +csharp_style_expression_bodied_properties = true:suggestion |
| 94 | + |
| 95 | +# IDE0160: Convert to file-scoped namespace |
| 96 | +csharp_style_namespace_declarations = file_scoped:warning |
| 97 | + |
| 98 | +#Style - expression level options |
| 99 | + |
| 100 | +#prefer out variables to be declared inline in the argument list of a method call when possible |
| 101 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 102 | +#prefer tuple names to ItemX properties |
| 103 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 104 | +#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them |
| 105 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 106 | + |
| 107 | +#Style - Expression-level preferences |
| 108 | + |
| 109 | +#prefer default over default(T) |
| 110 | +csharp_prefer_simple_default_expression = true:suggestion |
| 111 | +#prefer objects to be initialized using object initializers when possible |
| 112 | +dotnet_style_object_initializer = true:suggestion |
| 113 | +#prefer inferred tuple element names |
| 114 | +dotnet_style_prefer_inferred_tuple_names = 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 - Miscellaneous preferences |
| 122 | + |
| 123 | +#prefer local functions over anonymous functions |
| 124 | +csharp_style_pattern_local_over_anonymous_function = true:suggestion |
| 125 | + |
| 126 | +#Style - modifier options |
| 127 | + |
| 128 | +#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. |
| 129 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion |
| 130 | + |
| 131 | +#Style - Modifier preferences |
| 132 | + |
| 133 | +#when this rule is set to a list of modifiers, prefer the specified ordering. |
| 134 | +csharp_preferred_modifier_order = public,protected,private,internal,static,readonly,sealed,override:suggestion |
| 135 | + |
| 136 | +#Style - qualification options |
| 137 | + |
| 138 | +#prefer fields to be prefaced with this. in C# or Me. in Visual Basic |
| 139 | +dotnet_style_qualification_for_field = false:suggestion |
| 140 | +#prefer methods not to be prefaced with this. or Me. in Visual Basic |
| 141 | +dotnet_style_qualification_for_method = false:suggestion |
| 142 | +#prefer properties not to be prefaced with this. or Me. in Visual Basic |
| 143 | +dotnet_style_qualification_for_property = false:suggestion |
0 commit comments