|
| 1 | +# Rules in this file were initially inferred by Visual Studio IntelliCode from the Template Studio codebase. |
| 2 | +# You can modify the rules from these initially generated values to suit your own policies. |
| 3 | +# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference. |
| 4 | + |
| 5 | +[*.cs] |
| 6 | + |
| 7 | +#Core editorconfig formatting - indentation |
| 8 | + |
| 9 | +#use soft tabs (spaces) for indentation |
| 10 | +indent_style = space |
| 11 | + |
| 12 | +#Formatting - new line options |
| 13 | + |
| 14 | +#place else statements on a new line |
| 15 | +csharp_new_line_before_else = true |
| 16 | +#require braces to be on a new line for lambdas, methods, control_blocks, types, properties, and accessors (also known as "Allman" style) |
| 17 | +csharp_new_line_before_open_brace = all |
| 18 | + |
| 19 | +#Formatting - organize using options |
| 20 | + |
| 21 | +#sort System.* using directives alphabetically, and place them before other usings |
| 22 | +dotnet_sort_system_directives_first = true |
| 23 | + |
| 24 | +#Formatting - spacing options |
| 25 | + |
| 26 | +#require NO space between a cast and the value |
| 27 | +csharp_space_after_cast = false |
| 28 | +#require a space before the colon for bases or interfaces in a type declaration |
| 29 | +csharp_space_after_colon_in_inheritance_clause = true |
| 30 | +#require a space after a keyword in a control flow statement such as a for loop |
| 31 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 32 | +#require a space before the colon for bases or interfaces in a type declaration |
| 33 | +csharp_space_before_colon_in_inheritance_clause = true |
| 34 | +#remove space within empty argument list parentheses |
| 35 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 36 | +#remove space between method call name and opening parenthesis |
| 37 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 38 | +#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call |
| 39 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 40 | +#remove space within empty parameter list parentheses for a method declaration |
| 41 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 42 | +#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. |
| 43 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 44 | + |
| 45 | +#Formatting - wrapping options |
| 46 | + |
| 47 | +#leave code block on separate lines |
| 48 | +csharp_preserve_single_line_blocks = false |
| 49 | + |
| 50 | +#Style - Code block preferences |
| 51 | + |
| 52 | +#prefer curly braces even for one line of code |
| 53 | +csharp_prefer_braces = true:suggestion |
| 54 | + |
| 55 | +#Style - expression bodied member options |
| 56 | + |
| 57 | +#prefer expression bodies for accessors |
| 58 | +csharp_style_expression_bodied_accessors = true:warning |
| 59 | +#prefer block bodies for constructors |
| 60 | +csharp_style_expression_bodied_constructors = false:suggestion |
| 61 | +#prefer expression bodies for methods |
| 62 | +csharp_style_expression_bodied_methods = when_on_single_line:silent |
| 63 | +#prefer expression-bodied members for properties |
| 64 | +csharp_style_expression_bodied_properties = true:warning |
| 65 | + |
| 66 | +#Style - expression level options |
| 67 | + |
| 68 | +#prefer out variables to be declared before the method call |
| 69 | +csharp_style_inlined_variable_declaration = false:suggestion |
| 70 | +#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them |
| 71 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 72 | + |
| 73 | +#Style - Expression-level preferences |
| 74 | + |
| 75 | +#prefer default over default(T) |
| 76 | +csharp_prefer_simple_default_expression = true:suggestion |
| 77 | +#prefer objects to be initialized using object initializers when possible |
| 78 | +dotnet_style_object_initializer = true:suggestion |
| 79 | + |
| 80 | +#Style - implicit and explicit types |
| 81 | + |
| 82 | +#prefer var over explicit type in all cases, unless overridden by another code style rule |
| 83 | +csharp_style_var_elsewhere = true:suggestion |
| 84 | +#prefer var is used to declare variables with built-in system types such as int |
| 85 | +csharp_style_var_for_built_in_types = true:suggestion |
| 86 | +#prefer var when the type is already mentioned on the right-hand side of a declaration expression |
| 87 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 88 | + |
| 89 | +#Style - language keyword and framework type options |
| 90 | + |
| 91 | +#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 |
| 92 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 93 | + |
| 94 | +#Style - Language rules |
| 95 | +csharp_style_implicit_object_creation_when_type_is_apparent = true:warning |
| 96 | +csharp_style_var_for_built_in_types = true:warning |
| 97 | + |
| 98 | +#Style - modifier options |
| 99 | + |
| 100 | +#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. |
| 101 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion |
| 102 | + |
| 103 | +#Style - Modifier preferences |
| 104 | + |
| 105 | +#when this rule is set to a list of modifiers, prefer the specified ordering. |
| 106 | +csharp_preferred_modifier_order = public,private,protected,internal,static,async,readonly,override,sealed,abstract,virtual:warning |
| 107 | +dotnet_style_readonly_field = true:warning |
| 108 | + |
| 109 | +#Style - Pattern matching |
| 110 | + |
| 111 | +#prefer pattern matching instead of is expression with type casts |
| 112 | +csharp_style_pattern_matching_over_as_with_null_check = true:warning |
| 113 | + |
| 114 | +#Style - qualification options |
| 115 | + |
| 116 | +#prefer events not to be prefaced with this. or Me. in Visual Basic |
| 117 | +dotnet_style_qualification_for_event = false:suggestion |
| 118 | +#prefer fields not to be prefaced with this. or Me. in Visual Basic |
| 119 | +dotnet_style_qualification_for_field = false:suggestion |
| 120 | +#prefer methods not to be prefaced with this. or Me. in Visual Basic |
| 121 | +dotnet_style_qualification_for_method = false:suggestion |
| 122 | +#prefer properties not to be prefaced with this. or Me. in Visual Basic |
| 123 | +dotnet_style_qualification_for_property = false:suggestion |
| 124 | +csharp_indent_labels = one_less_than_current |
| 125 | +csharp_using_directive_placement = outside_namespace:silent |
| 126 | +csharp_prefer_simple_using_statement = true:warning |
| 127 | +csharp_style_namespace_declarations = file_scoped:warning |
| 128 | +csharp_style_expression_bodied_operators = false:silent |
| 129 | +csharp_style_expression_bodied_indexers = true:silent |
| 130 | +csharp_style_expression_bodied_lambdas = true:silent |
| 131 | +csharp_style_expression_bodied_local_functions = false:silent |
| 132 | + |
| 133 | +[*.{cs,vb}] |
| 134 | +dotnet_style_operator_placement_when_wrapping = beginning_of_line |
| 135 | +tab_width = 4 |
| 136 | +indent_size = 4 |
| 137 | +end_of_line = crlf |
| 138 | +dotnet_style_coalesce_expression = true:suggestion |
| 139 | +dotnet_style_null_propagation = true:suggestion |
| 140 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion |
| 141 | +dotnet_style_prefer_auto_properties = true:silent |
| 142 | +dotnet_style_object_initializer = true:suggestion |
| 143 | +dotnet_style_collection_initializer = true:suggestion |
| 144 | +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion |
| 145 | +dotnet_style_prefer_conditional_expression_over_assignment = true:silent |
| 146 | +dotnet_style_prefer_conditional_expression_over_return = true:silent |
| 147 | +[*.{cs,vb}] |
| 148 | + |
| 149 | +#Style - Unnecessary code rules |
| 150 | +csharp_style_unused_value_assignment_preference = discard_variable:warning |
| 151 | + |
| 152 | +#### Naming styles #### |
| 153 | + |
| 154 | +# Naming rules |
| 155 | + |
| 156 | +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion |
| 157 | +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface |
| 158 | +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i |
| 159 | + |
| 160 | +dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion |
| 161 | +dotnet_naming_rule.types_should_be_pascal_case.symbols = types |
| 162 | +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case |
| 163 | + |
| 164 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion |
| 165 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members |
| 166 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case |
| 167 | + |
| 168 | +# Symbol specifications |
| 169 | + |
| 170 | +dotnet_naming_symbols.interface.applicable_kinds = interface |
| 171 | +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 172 | +dotnet_naming_symbols.interface.required_modifiers = |
| 173 | + |
| 174 | +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum |
| 175 | +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 176 | +dotnet_naming_symbols.types.required_modifiers = |
| 177 | + |
| 178 | +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method |
| 179 | +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 180 | +dotnet_naming_symbols.non_field_members.required_modifiers = |
| 181 | + |
| 182 | +# Naming styles |
| 183 | + |
| 184 | +dotnet_naming_style.begins_with_i.required_prefix = I |
| 185 | +dotnet_naming_style.begins_with_i.required_suffix = |
| 186 | +dotnet_naming_style.begins_with_i.word_separator = |
| 187 | +dotnet_naming_style.begins_with_i.capitalization = pascal_case |
| 188 | + |
| 189 | +dotnet_naming_style.pascal_case.required_prefix = |
| 190 | +dotnet_naming_style.pascal_case.required_suffix = |
| 191 | +dotnet_naming_style.pascal_case.word_separator = |
| 192 | +dotnet_naming_style.pascal_case.capitalization = pascal_case |
| 193 | + |
| 194 | +dotnet_naming_style.pascal_case.required_prefix = |
| 195 | +dotnet_naming_style.pascal_case.required_suffix = |
| 196 | +dotnet_naming_style.pascal_case.word_separator = |
| 197 | +dotnet_naming_style.pascal_case.capitalization = pascal_case |
| 198 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 199 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 200 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 201 | +dotnet_style_prefer_compound_assignment = true:warning |
| 202 | +dotnet_style_prefer_simplified_interpolation = true:suggestion |
0 commit comments