|
| 1 | +# editorconfig.org |
| 2 | +root = true |
| 3 | + |
| 4 | +[*] |
| 5 | +indent_style = space |
| 6 | +indent_size = 4 |
| 7 | +end_of_line = crlf |
| 8 | +charset = utf-8 |
| 9 | +trim_trailing_whitespace = true |
| 10 | +insert_final_newline = true |
| 11 | + |
| 12 | +[*.cs] |
| 13 | +indent_size = 4 |
| 14 | +end_of_line = crlf |
| 15 | + |
| 16 | +# "This." and "Me." qualifiers: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#this_and_me |
| 17 | +dotnet_style_qualification_for_field = false : silent |
| 18 | +dotnet_style_qualification_for_property = false : silent |
| 19 | +dotnet_style_qualification_for_method = false : silent |
| 20 | +dotnet_style_qualification_for_event = false : silent |
| 21 | + |
| 22 | +# Language keywords instead of framework type names for type references: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#language_keywords |
| 23 | +dotnet_style_predefined_type_for_locals_parameters_members = true : warning |
| 24 | +dotnet_style_predefined_type_for_member_access = true : warning |
| 25 | + |
| 26 | +# Modifier preferences: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#normalize_modifiers |
| 27 | +dotnet_style_require_accessibility_modifiers = always : warning |
| 28 | +sharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async : warning |
| 29 | + |
| 30 | +# Expression-level preferences: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_level |
| 31 | +dotnet_style_object_initializer = true : warning |
| 32 | +dotnet_style_collection_initializer = true : warning |
| 33 | +dotnet_style_explicit_tuple_names = true : warning |
| 34 | +dotnet_style_prefer_inferred_tuple_names = true : warning |
| 35 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true : warning |
| 36 | + |
| 37 | +# Null-checking preferences: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#null_checking |
| 38 | +dotnet_style_coalesce_expression = true : warning |
| 39 | +dotnet_style_null_propagation = true : warning |
| 40 | + |
| 41 | +# Implicit and explicit types: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#var |
| 42 | +csharp_style_var_for_built_in_types = false : warning |
| 43 | +csharp_style_var_when_type_is_apparent = false : warning |
| 44 | +csharp_style_var_elsewhere = false : warning |
| 45 | + |
| 46 | +# Expression-bodied members: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_bodied_members |
| 47 | +csharp_style_expression_bodied_methods = false : silent |
| 48 | +csharp_style_expression_bodied_constructor = true : warning |
| 49 | +csharp_style_expression_bodied_operators = true : warning |
| 50 | +csharp_style_expression_bodied_properties = true : warning |
| 51 | +csharp_style_expression_bodied_indexers = true : warning |
| 52 | +csharp_style_expression_bodied_accessors = true : warning |
| 53 | + |
| 54 | +# Pattern matching: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#pattern_matching |
| 55 | +csharp_style_pattern_matching_over_is_with_cast_check = true : warning |
| 56 | +csharp_style_pattern_matching_over_as_with_null_check = true : warning |
| 57 | + |
| 58 | +# Inlined variable declarations: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#inlined_variable_declarations |
| 59 | +csharp_style_inlined_variable_declaration = true : warning |
| 60 | + |
| 61 | +# Expression-level preferences: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_level_csharp |
| 62 | +csharp_prefer_simple_default_expression = true : warning |
| 63 | +csharp_style_deconstructed_variable_declaration = true : warning |
| 64 | +csharp_style_pattern_local_over_anonymous_function = true : warning |
| 65 | + |
| 66 | +# "Null" checking preferences: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#null_checking_csharp |
| 67 | +csharp_style_throw_expression = true : warning |
| 68 | +csharp_style_conditional_delegate_call = true : warning |
| 69 | + |
| 70 | +# Code block preferences: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#code_block |
| 71 | +csharp_prefer_braces = false : silent |
| 72 | + |
| 73 | +# Organize usings: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#net-formatting-settings |
| 74 | +dotnet_sort_system_directives_first = true |
| 75 | + |
| 76 | +# C# formatting settings: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#c-formatting-settings |
| 77 | +csharp_new_line_before_open_brace = none |
| 78 | +csharp_new_line_before_else = false |
| 79 | +csharp_new_line_before_catch = false |
| 80 | +csharp_new_line_before_finally = false |
| 81 | +csharp_new_line_before_members_in_object_initializers = false |
| 82 | +csharp_new_line_before_members_in_anonymous_types = false |
| 83 | +csharp_new_line_between_query_expression_clauses = false |
| 84 | + |
| 85 | +# Indentation options: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#indent |
| 86 | +csharp_indent_case_contents = true |
| 87 | +csharp_indent_switch_labels = true |
| 88 | +csharp_indent_labels = one_less_than_current |
| 89 | + |
| 90 | +# Spacing options: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#spacing |
| 91 | +csharp_space_after_cast = true |
| 92 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 93 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 94 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 95 | +csharp_space_between_parentheses = false |
| 96 | + |
| 97 | +# Wrapping options: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#wrapping |
| 98 | +csharp_preserve_single_line_statements = false |
| 99 | +csharp_preserve_single_line_blocks = false |
| 100 | + |
| 101 | +############################### |
| 102 | +# Naming Conventions: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions |
| 103 | +############################### |
| 104 | + |
| 105 | +# Style Definitions |
| 106 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 107 | + |
| 108 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 109 | + |
| 110 | +dotnet_naming_style.I_prefix_style.required_prefix = I |
| 111 | +dotnet_naming_style.I_prefix_style.capitalization = pascal_case |
| 112 | + |
| 113 | +# Use PascalCase for constant fields |
| 114 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning |
| 115 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields |
| 116 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style |
| 117 | +dotnet_naming_symbols.constant_fields.applicable_kinds = field |
| 118 | +dotnet_naming_symbols.constant_fields.applicable_accessibilities = * |
| 119 | +dotnet_naming_symbols.constant_fields.required_modifiers = const |
| 120 | + |
| 121 | +# Use PascalCase for public fields |
| 122 | +dotnet_naming_rule.pascal_case_for_public_fields.severity = warning |
| 123 | +dotnet_naming_rule.pascal_case_for_public_fields.symbols = public_fields |
| 124 | +dotnet_naming_rule.pascal_case_for_public_fields.style = pascal_case_style |
| 125 | +dotnet_naming_symbols.public_fields.applicable_kinds = field |
| 126 | +dotnet_naming_symbols.public_fields.applicable_accessibilities = public |
| 127 | + |
| 128 | +# Use camelCase for private fields |
| 129 | +dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = silent |
| 130 | +dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group |
| 131 | +dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style |
| 132 | +dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field |
| 133 | +dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private |
| 134 | + |
| 135 | +# Interfaces must be PascalCase and have an I prefix |
| 136 | +dotnet_naming_rule.interfaces_start_with_I.severity = warning |
| 137 | +dotnet_naming_rule.interfaces_start_with_I.symbols = any_interface |
| 138 | +dotnet_naming_rule.interfaces_start_with_I.style = I_prefix_style |
| 139 | +dotnet_naming_symbols.any_interface.applicable_accessibilities = * |
| 140 | +dotnet_naming_symbols.any_interface.applicable_kinds = interface |
| 141 | + |
| 142 | +# Classes, structs, methods, enums, events, properties, namespaces, delegates must be PascalCase |
| 143 | +dotnet_naming_rule.general_naming.severity = warning |
| 144 | +dotnet_naming_rule.general_naming.symbols = general |
| 145 | +dotnet_naming_rule.general_naming.style = pascal_case_style |
| 146 | +dotnet_naming_symbols.general.applicable_kinds = class,struct,enum,property,method,event,namespace,delegate |
| 147 | +dotnet_naming_symbols.general.applicable_accessibilities = * |
| 148 | + |
| 149 | +# Everything else is camelCase |
| 150 | +dotnet_naming_rule.everything_else_naming.severity = warning |
| 151 | +dotnet_naming_rule.everything_else_naming.symbols = everything_else |
| 152 | +dotnet_naming_rule.everything_else_naming.style = camel_case_style |
| 153 | +dotnet_naming_symbols.everything_else.applicable_kinds = * |
| 154 | +dotnet_naming_symbols.everything_else.applicable_accessibilities = * |
0 commit comments