|
| 1 | +# Schema: http://EditorConfig.org |
| 2 | +# Docs: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference |
| 3 | + |
| 4 | +# top-most EditorConfig file |
| 5 | +root = true |
| 6 | + |
| 7 | +# Don't use tabs for indentation. |
| 8 | +[*] |
| 9 | +indent_style = space |
| 10 | +trim_trailing_whitespace = true |
| 11 | +guidelines = 140 |
| 12 | +max_line_length = 140 |
| 13 | + |
| 14 | +# Code files |
| 15 | +[*.{cs,csx,vb,vbx}] |
| 16 | +indent_size = 4 |
| 17 | +insert_final_newline = true |
| 18 | +#charset = utf-8-bom |
| 19 | + |
| 20 | +# Xml project files |
| 21 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] |
| 22 | +indent_size = 2 |
| 23 | + |
| 24 | +# Xml config files |
| 25 | +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,xml,stylecop}] |
| 26 | +indent_size = 2 |
| 27 | + |
| 28 | +# JSON files |
| 29 | +[*.json] |
| 30 | +indent_size = 2 |
| 31 | + |
| 32 | +# Powershell files |
| 33 | +[*.ps1] |
| 34 | +indent_size = 2 |
| 35 | + |
| 36 | +# Shell scripts |
| 37 | +[*.sh] |
| 38 | +end_of_line = lf |
| 39 | +indent_size = 2 |
| 40 | + |
| 41 | +[*.{cmd,bat}] |
| 42 | +end_of_line = crlf |
| 43 | +indent_size = 2 |
| 44 | + |
| 45 | +## Language conventions |
| 46 | +# Dotnet code style settings: |
| 47 | +[*.{cs,vb}] |
| 48 | +# "This." and "Me." qualifiers |
| 49 | +dotnet_style_qualification_for_field = false:suggestion |
| 50 | +dotnet_style_qualification_for_property = false:suggestion |
| 51 | +dotnet_style_qualification_for_method = false:suggestion |
| 52 | +dotnet_style_qualification_for_event = false:suggestion |
| 53 | + |
| 54 | +# Language keywords instead of framework type names for type references |
| 55 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 56 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 57 | + |
| 58 | +# Modifier preferences |
| 59 | +dotnet_style_require_accessibility_modifiers = always:suggestion |
| 60 | +dotnet_style_readonly_field = true:warning |
| 61 | + |
| 62 | +# Parentheses preferences |
| 63 | +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent |
| 64 | +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent |
| 65 | +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent |
| 66 | +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent |
| 67 | + |
| 68 | +# Expression-level preferences |
| 69 | +dotnet_style_object_initializer = true:suggestion |
| 70 | +dotnet_style_collection_initializer = true:suggestion |
| 71 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 72 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 73 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 74 | +dotnet_style_prefer_auto_properties = true:silent |
| 75 | +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion |
| 76 | +dotnet_style_prefer_conditional_expression_over_return = true:suggestion |
| 77 | + |
| 78 | +# Null-checking preferences |
| 79 | +dotnet_style_coalesce_expression = true:suggestion |
| 80 | +dotnet_style_null_propagation = true:suggestion |
| 81 | + |
| 82 | +# CSharp code style settings: |
| 83 | +[*.cs] |
| 84 | +# Modifier preferences |
| 85 | +csharp_preferred_modifier_order = public,private,protected,internal,const,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion |
| 86 | + |
| 87 | +# Implicit and explicit types |
| 88 | +csharp_style_var_for_built_in_types = true:suggestion |
| 89 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 90 | +csharp_style_var_elsewhere = true:suggestion |
| 91 | + |
| 92 | +# Expression-bodied members |
| 93 | +# Explicitly disabled due to difference in coding style between source and tests |
| 94 | +#csharp_style_expression_bodied_methods = false:silent |
| 95 | +#csharp_style_expression_bodied_constructors = false:silent |
| 96 | +csharp_style_expression_bodied_operators = false:silent |
| 97 | +csharp_style_expression_bodied_properties = true:suggestion |
| 98 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 99 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 100 | + |
| 101 | +# Pattern matching |
| 102 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 103 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 104 | + |
| 105 | +# Inlined variable declarations |
| 106 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 107 | + |
| 108 | +# Expression-level preferences |
| 109 | +csharp_prefer_simple_default_expression = true:suggestion |
| 110 | +csharp_style_deconstructed_variable_declaration = true:suggestion |
| 111 | +csharp_style_pattern_local_over_anonymous_function = true:suggestion |
| 112 | + |
| 113 | +# Null-checking preference |
| 114 | +csharp_style_throw_expression = true:suggestion |
| 115 | +csharp_style_conditional_delegate_call = true:suggestion |
| 116 | + |
| 117 | +# Code block preferences |
| 118 | +csharp_prefer_braces = true:suggestion |
| 119 | + |
| 120 | +## Formatting conventions |
| 121 | +# Dotnet formatting settings: |
| 122 | +[*.{cs,vb}] |
| 123 | +# Organize usings |
| 124 | +dotnet_sort_system_directives_first = true |
| 125 | +dotnet_separate_import_directive_groups = false |
| 126 | + |
| 127 | +# CSharp formatting settings: |
| 128 | +[*.cs] |
| 129 | +# Newline options |
| 130 | +csharp_new_line_before_open_brace = all |
| 131 | +csharp_new_line_before_else = true |
| 132 | +csharp_new_line_before_catch = true |
| 133 | +csharp_new_line_before_finally = true |
| 134 | +csharp_new_line_before_members_in_object_initializers = true |
| 135 | +csharp_new_line_before_members_in_anonymous_types = true |
| 136 | +csharp_new_line_between_query_expression_clauses = true |
| 137 | + |
| 138 | +# Identation options |
| 139 | +csharp_indent_block_contents = true |
| 140 | +csharp_indent_braces = false |
| 141 | +csharp_indent_case_contents_when_block = false |
| 142 | +csharp_indent_switch_labels = true |
| 143 | +csharp_indent_case_contents = true |
| 144 | +csharp_indent_labels = no_change |
| 145 | + |
| 146 | +# Spacing options |
| 147 | +csharp_space_after_cast = false |
| 148 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 149 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 150 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 151 | +csharp_space_between_parentheses = false |
| 152 | +csharp_space_before_colon_in_inheritance_clause = true |
| 153 | +csharp_space_after_colon_in_inheritance_clause = true |
| 154 | +csharp_space_around_binary_operators = before_and_after |
| 155 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 156 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 157 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 158 | +csharp_space_after_comma = true |
| 159 | +csharp_space_after_dot = false |
| 160 | +csharp_space_after_semicolon_in_for_statement = true |
| 161 | +csharp_space_around_declaration_statements = do_not_ignore |
| 162 | +csharp_space_before_comma = false |
| 163 | +csharp_space_before_dot = false |
| 164 | +csharp_space_before_open_square_brackets = false |
| 165 | +csharp_space_before_semicolon_in_for_statement = false |
| 166 | +csharp_space_between_empty_square_brackets = false |
| 167 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 168 | +csharp_space_between_square_brackets = false |
| 169 | + |
| 170 | +# Wrap options |
| 171 | +csharp_preserve_single_line_statements = true |
| 172 | +csharp_preserve_single_line_blocks = true |
| 173 | + |
| 174 | +## Naming conventions |
| 175 | +[*.{cs,vb}] |
| 176 | + |
| 177 | +## Naming styles |
| 178 | + |
| 179 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 180 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 181 | + |
| 182 | +# PascalCase with I prefix |
| 183 | +dotnet_naming_style.interface_style.capitalization = pascal_case |
| 184 | +dotnet_naming_style.interface_style.required_prefix = I |
| 185 | + |
| 186 | +# PascalCase with T prefix |
| 187 | +dotnet_naming_style.type_parameter_style.capitalization = pascal_case |
| 188 | +dotnet_naming_style.type_parameter_style.required_prefix = T |
| 189 | + |
| 190 | +# camelCase with _ prefix |
| 191 | +dotnet_naming_style._camelCase.capitalization = camel_case |
| 192 | +dotnet_naming_style._camelCase.required_prefix = _ |
| 193 | + |
| 194 | +## Rules |
| 195 | +# Interfaces |
| 196 | +dotnet_naming_symbols.interface_symbol.applicable_kinds = interface |
| 197 | +dotnet_naming_symbols.interface_symbol.applicable_accessibilities = * |
| 198 | +dotnet_naming_rule.interface_naming.symbols = interface_symbol |
| 199 | +dotnet_naming_rule.interface_naming.style = interface_style |
| 200 | +dotnet_naming_rule.interface_naming.severity = suggestion |
| 201 | + |
| 202 | +# Classes, Structs, Enums, Properties, Methods, Local Functions, Events, Namespaces |
| 203 | +dotnet_naming_symbols.class_symbol.applicable_kinds = class, struct, enum, property, method, local_function, event, namespace, delegate |
| 204 | +dotnet_naming_symbols.class_symbol.applicable_accessibilities = * |
| 205 | + |
| 206 | +dotnet_naming_rule.class_naming.symbols = class_symbol |
| 207 | +dotnet_naming_rule.class_naming.style = pascal_case_style |
| 208 | +dotnet_naming_rule.class_naming.severity = suggestion |
| 209 | + |
| 210 | +# Type Parameters |
| 211 | +dotnet_naming_symbols.type_parameter_symbol.applicable_kinds = type_parameter |
| 212 | +dotnet_naming_symbols.type_parameter_symbol.applicable_accessibilities = * |
| 213 | + |
| 214 | +dotnet_naming_rule.type_parameter_naming.symbols = type_parameter_symbol |
| 215 | +dotnet_naming_rule.type_parameter_naming.style = type_parameter_style |
| 216 | +dotnet_naming_rule.type_parameter_naming.severity = suggestion |
| 217 | + |
| 218 | +# Visible Fields |
| 219 | +dotnet_naming_symbols.public_field_symbol.applicable_kinds = field |
| 220 | +dotnet_naming_symbols.public_field_symbol.applicable_accessibilities = public, internal, protected, protected_internal, private_protected |
| 221 | + |
| 222 | +dotnet_naming_rule.public_field_naming.symbols = public_field_symbol |
| 223 | +dotnet_naming_rule.public_field_naming.style = pascal_case_style |
| 224 | +dotnet_naming_rule.public_field_naming.severity = suggestion |
| 225 | + |
| 226 | +# Private constant Fields |
| 227 | +dotnet_naming_symbols.const_field_symbol.applicable_kinds = field |
| 228 | +dotnet_naming_symbols.const_field_symbol.applicable_accessibilities = private |
| 229 | +dotnet_naming_symbols.const_field_symbol.required_modifiers = const |
| 230 | + |
| 231 | +dotnet_naming_rule.const_field_naming.symbols = const_field_symbol |
| 232 | +dotnet_naming_rule.const_field_naming.style = pascal_case_style |
| 233 | +dotnet_naming_rule.const_field_naming.severity = suggestion |
| 234 | + |
| 235 | +# Parameters |
| 236 | +dotnet_naming_symbols.parameter_symbol.applicable_kinds = parameter |
| 237 | +dotnet_naming_symbols.parameter_symbol.applicable_accessibilities = * |
| 238 | + |
| 239 | +dotnet_naming_rule.parameter_naming.symbols = parameter_symbol |
| 240 | +dotnet_naming_rule.parameter_naming.style = camel_case_style |
| 241 | +dotnet_naming_rule.parameter_naming.severity = suggestion |
| 242 | + |
| 243 | +# Everything Local |
| 244 | +dotnet_naming_symbols.everything_else.applicable_kinds = local |
| 245 | +dotnet_naming_symbols.everything_else.applicable_accessibilities = * |
| 246 | + |
| 247 | +dotnet_naming_rule.everything_else_naming.symbols = everything_else |
| 248 | +dotnet_naming_rule.everything_else_naming.style = camel_case_style |
| 249 | +dotnet_naming_rule.everything_else_naming.severity = suggestion |
| 250 | + |
| 251 | +# Microsoft .NET properties |
| 252 | +csharp_style_expression_bodied_methods = true:suggestion |
| 253 | + |
| 254 | +# ReSharper properties |
| 255 | +resharper_local_function_body = expression_body |
0 commit comments