|
| 1 | +# EditorConfig is awesome: https://EditorConfig.org |
| 2 | + |
| 3 | +# Top-most EditorConfig file |
| 4 | +root = true |
| 5 | + |
| 6 | +# All files |
| 7 | +[*] |
| 8 | +charset = utf-8 |
| 9 | +insert_final_newline = true |
| 10 | +trim_trailing_whitespace = true |
| 11 | + |
| 12 | +# Code files |
| 13 | +[*.{cs,csx,vb,vbx}] |
| 14 | +indent_style = tab |
| 15 | +indent_size = 4 |
| 16 | +end_of_line = crlf |
| 17 | + |
| 18 | +# XML project files |
| 19 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] |
| 20 | +indent_style = tab |
| 21 | +indent_size = 2 |
| 22 | + |
| 23 | +# XML config files |
| 24 | +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] |
| 25 | +indent_style = tab |
| 26 | +indent_size = 2 |
| 27 | + |
| 28 | +# JSON files |
| 29 | +[*.json] |
| 30 | +indent_style = tab |
| 31 | +indent_size = 2 |
| 32 | + |
| 33 | +# YAML files |
| 34 | +[*.{yml,yaml}] |
| 35 | +indent_style = space |
| 36 | +indent_size = 2 |
| 37 | + |
| 38 | +# Markdown files |
| 39 | +[*.md] |
| 40 | +indent_style = space |
| 41 | +trim_trailing_whitespace = false |
| 42 | + |
| 43 | +# Shell scripts |
| 44 | +[*.{sh,ps1,cmd}] |
| 45 | +end_of_line = crlf |
| 46 | + |
| 47 | +# Dotnet code style settings: |
| 48 | +[*.{cs,vb}] |
| 49 | + |
| 50 | +# Sort using and Import directives with System.* appearing first |
| 51 | +dotnet_sort_system_directives_first = true |
| 52 | +dotnet_separate_import_directive_groups = false |
| 53 | + |
| 54 | +# Avoid "this." and "Me." if not necessary |
| 55 | +dotnet_style_qualification_for_field = false:refactoring |
| 56 | +dotnet_style_qualification_for_property = false:refactoring |
| 57 | +dotnet_style_qualification_for_method = false:refactoring |
| 58 | +dotnet_style_qualification_for_event = false:refactoring |
| 59 | + |
| 60 | +# Use language keywords instead of framework type names for type references |
| 61 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 62 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 63 | + |
| 64 | +# Suggest more modern language features when available |
| 65 | +dotnet_style_object_initializer = true:suggestion |
| 66 | +dotnet_style_collection_initializer = true:suggestion |
| 67 | +dotnet_style_coalesce_expression = true:suggestion |
| 68 | +dotnet_style_null_propagation = true:suggestion |
| 69 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 70 | + |
| 71 | +# Whitespace options |
| 72 | +dotnet_style_allow_multiple_blank_lines_experimental = true |
| 73 | + |
| 74 | +# Non-private static fields are PascalCase |
| 75 | +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion |
| 76 | +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields |
| 77 | +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style |
| 78 | + |
| 79 | +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field |
| 80 | +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected |
| 81 | +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static |
| 82 | + |
| 83 | +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case |
| 84 | + |
| 85 | +# Non-private readonly fields are PascalCase |
| 86 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion |
| 87 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields |
| 88 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style |
| 89 | + |
| 90 | +dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field |
| 91 | +dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected |
| 92 | +dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly |
| 93 | + |
| 94 | +dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case |
| 95 | + |
| 96 | +# Constants are ALL_CAPS |
| 97 | +dotnet_naming_rule.constants_should_be_all_caps.severity = suggestion |
| 98 | +dotnet_naming_rule.constants_should_be_all_caps.symbols = constants |
| 99 | +dotnet_naming_rule.constants_should_be_all_caps.style = constant_style |
| 100 | + |
| 101 | +dotnet_naming_symbols.constants.applicable_kinds = field, local |
| 102 | +dotnet_naming_symbols.constants.required_modifiers = const |
| 103 | + |
| 104 | +dotnet_naming_style.constant_style.capitalization = all_upper |
| 105 | +dotnet_naming_style.constant_style.word_separator = _ |
| 106 | + |
| 107 | +# Static fields are PascalCase and start with _ |
| 108 | +dotnet_naming_rule.static_fields_should_be_pascal_case.severity = suggestion |
| 109 | +dotnet_naming_rule.static_fields_should_be_pascal_case.symbols = static_fields |
| 110 | +dotnet_naming_rule.static_fields_should_be_pascal_case.style = private_field_style |
| 111 | + |
| 112 | +dotnet_naming_symbols.static_fields.applicable_kinds = field |
| 113 | +dotnet_naming_symbols.static_fields.required_modifiers = static |
| 114 | + |
| 115 | +dotnet_naming_style.private_field_style.capitalization = pascal_case |
| 116 | +dotnet_naming_style.private_field_style.required_prefix = _ |
| 117 | + |
| 118 | +# Instance fields are PascalCase and start with _ |
| 119 | +dotnet_naming_rule.instance_fields_should_be_pascal_case.severity = suggestion |
| 120 | +dotnet_naming_rule.instance_fields_should_be_pascal_case.symbols = instance_fields |
| 121 | +dotnet_naming_rule.instance_fields_should_be_pascal_case.style = private_field_style |
| 122 | + |
| 123 | +dotnet_naming_symbols.instance_fields.applicable_kinds = field |
| 124 | + |
| 125 | +# Locals and parameters are camelCase |
| 126 | +dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion |
| 127 | +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters |
| 128 | +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style |
| 129 | + |
| 130 | +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local |
| 131 | + |
| 132 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 133 | + |
| 134 | +# Local functions are PascalCase |
| 135 | +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion |
| 136 | +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions |
| 137 | +dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style |
| 138 | + |
| 139 | +dotnet_naming_symbols.local_functions.applicable_kinds = local_function |
| 140 | + |
| 141 | +dotnet_naming_style.local_function_style.capitalization = pascal_case |
| 142 | + |
| 143 | +# By default, name items with PascalCase |
| 144 | +dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion |
| 145 | +dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members |
| 146 | +dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style |
| 147 | + |
| 148 | +dotnet_naming_symbols.all_members.applicable_kinds = * |
| 149 | + |
| 150 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 151 | + |
| 152 | +# CSharp code style settings: |
| 153 | +[*.cs] |
| 154 | + |
| 155 | +# Newline settings |
| 156 | +csharp_new_line_before_open_brace = all |
| 157 | +csharp_new_line_before_else = true |
| 158 | +csharp_new_line_before_catch = true |
| 159 | +csharp_new_line_before_finally = true |
| 160 | +csharp_new_line_before_members_in_object_initializers = true |
| 161 | +csharp_new_line_before_members_in_anonymous_types = true |
| 162 | +csharp_new_line_between_query_expression_clauses = true |
| 163 | + |
| 164 | +# Indentation preferences |
| 165 | +csharp_indent_block_contents = true |
| 166 | +csharp_indent_braces = false |
| 167 | +csharp_indent_case_contents = true |
| 168 | +csharp_indent_case_contents_when_block = true |
| 169 | +csharp_indent_switch_labels = true |
| 170 | +csharp_indent_labels = flush_left |
| 171 | + |
| 172 | +# Prefer "var" everywhere |
| 173 | +csharp_style_var_for_built_in_types = true:suggestion |
| 174 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 175 | +csharp_style_var_elsewhere = true:suggestion |
| 176 | + |
| 177 | +# Prefer method-like constructs to have a block body |
| 178 | +csharp_style_expression_bodied_methods = false:none |
| 179 | +csharp_style_expression_bodied_constructors = false:none |
| 180 | +csharp_style_expression_bodied_operators = false:none |
| 181 | + |
| 182 | +# Prefer property-like constructs to have an expression-body |
| 183 | +csharp_style_expression_bodied_properties = true:none |
| 184 | +csharp_style_expression_bodied_indexers = true:none |
| 185 | +csharp_style_expression_bodied_accessors = true:none |
| 186 | + |
| 187 | +# Suggest more modern language features when available |
| 188 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 189 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 190 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 191 | +csharp_style_throw_expression = true:suggestion |
| 192 | +csharp_style_conditional_delegate_call = true:suggestion |
| 193 | + |
| 194 | +# Space preferences |
| 195 | +csharp_space_after_cast = false |
| 196 | +csharp_space_after_colon_in_inheritance_clause = true |
| 197 | +csharp_space_after_comma = true |
| 198 | +csharp_space_after_dot = false |
| 199 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 200 | +csharp_space_after_semicolon_in_for_statement = true |
| 201 | +csharp_space_around_binary_operators = before_and_after |
| 202 | +csharp_space_around_declaration_statements = false |
| 203 | +csharp_space_before_colon_in_inheritance_clause = true |
| 204 | +csharp_space_before_comma = false |
| 205 | +csharp_space_before_dot = false |
| 206 | +csharp_space_before_open_square_brackets = false |
| 207 | +csharp_space_before_semicolon_in_for_statement = false |
| 208 | +csharp_space_between_empty_square_brackets = false |
| 209 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 210 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 211 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 212 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 213 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 214 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 215 | +csharp_space_between_parentheses = false |
| 216 | +csharp_space_between_square_brackets = false |
| 217 | + |
| 218 | +# Blocks are allowed |
| 219 | +csharp_prefer_braces = true:silent |
| 220 | +csharp_preserve_single_line_blocks = true |
| 221 | +csharp_preserve_single_line_statements = true |
| 222 | + |
| 223 | +# Currently only enabled for C# due to issue https://github.com/dotnet/roslyn/issues/38918 |
| 224 | +dotnet_style_prefer_simplified_interpolation = true:suggestion |
| 225 | + |
| 226 | +csharp_using_directive_placement = outside_namespace:suggestion |
| 227 | +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion |
| 228 | + |
| 229 | +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion |
| 230 | +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion |
| 231 | +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion |
| 232 | +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion |
0 commit comments