|
| 1 | +root=true |
| 2 | + |
| 3 | +[*] |
| 4 | +charset = utf-8 |
| 5 | +indent_style = tab |
| 6 | +indent_size = 4 |
| 7 | +# Spell checker configuration |
| 8 | +spelling_exclusion_path = "./build/exclusion.dic" |
| 9 | + |
| 10 | +[*.{fs,fsx,cs,vb}] |
| 11 | +file_header_template=Licensed to Elasticsearch B.V under one or more agreements.\nElasticsearch B.V licenses this file to you under the Apache 2.0 License.\nSee the LICENSE file in the project root for more information |
| 12 | + |
| 13 | +[*.{fs,fsx}] |
| 14 | +indent_style = space |
| 15 | +indent_size = 4 |
| 16 | + |
| 17 | +[*.{md,markdown,json,js,yml,csproj,fsproj,targets,targets,props}] |
| 18 | +indent_style = space |
| 19 | +indent_size = 2 |
| 20 | + |
| 21 | +# Dotnet code style settings: |
| 22 | +[*.{cs,vb}] |
| 23 | +trim_trailing_whitespace=true |
| 24 | +insert_final_newline=true |
| 25 | +# --- |
| 26 | +# naming conventions https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions |
| 27 | +# currently not supported in Rider/Resharper so not using these for now |
| 28 | +# --- |
| 29 | + |
| 30 | +# --- |
| 31 | +# language conventions https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#language-conventions |
| 32 | + |
| 33 | +# Sort using and Import directives with System.* appearing first |
| 34 | +dotnet_sort_system_directives_first = true |
| 35 | + |
| 36 | +# Style rules |
| 37 | +# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/naming-rules?view=vs-2017 |
| 38 | + |
| 39 | +# Constants always pascal case |
| 40 | +dotnet_naming_rule.constants_should_be_pascal_case.symbols = consts |
| 41 | +dotnet_naming_rule.constants_should_be_pascal_case.style = consts |
| 42 | +dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion |
| 43 | + |
| 44 | +dotnet_naming_symbols.consts.applicable_kinds = field |
| 45 | +dotnet_naming_symbols.consts.applicable_accessibilities = * |
| 46 | +dotnet_naming_symbols.consts.required_modifiers = const |
| 47 | + |
| 48 | +dotnet_naming_style.consts.capitalization = pascal_case |
| 49 | + |
| 50 | +# Non-public static fields always pascal case |
| 51 | +dotnet_naming_rule.non_public_static_fields_should_be_pascal_case.symbols = non_public_static_fields |
| 52 | +dotnet_naming_rule.non_public_static_fields_should_be_pascal_case.style = non_public_static_fields |
| 53 | +dotnet_naming_rule.non_public_static_fields_should_be_pascal_case.severity = suggestion |
| 54 | + |
| 55 | +dotnet_naming_symbols.non_public_static_fields.applicable_kinds = field |
| 56 | +dotnet_naming_symbols.non_public_static_fields.applicable_accessibilities = private,protected,internal,protected_internal,private_protected |
| 57 | +dotnet_naming_symbols.non_public_static_fields.required_modifiers = static |
| 58 | + |
| 59 | +dotnet_naming_style.non_public_static_fields.capitalization = pascal_case |
| 60 | + |
| 61 | +# Non-private readonly fields are pascal case |
| 62 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion |
| 63 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields |
| 64 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_fields |
| 65 | + |
| 66 | +dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field |
| 67 | +dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public,protected,internal,protected_internal,private_protected |
| 68 | +dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly |
| 69 | + |
| 70 | +dotnet_naming_style.non_private_readonly_fields.capitalization = pascal_case |
| 71 | + |
| 72 | +# Private instance fields are camel case prefixed underscore |
| 73 | +dotnet_naming_rule.private_fields_should_be_camelcase_prefix_underscore.symbols = private_fields |
| 74 | +dotnet_naming_rule.private_fields_should_be_camelcase_prefix_underscore.style = private_fields |
| 75 | +dotnet_naming_rule.private_fields_should_be_camelcase_prefix_underscore.severity = suggestion |
| 76 | + |
| 77 | +dotnet_naming_symbols.private_fields.applicable_kinds = field |
| 78 | +dotnet_naming_symbols.private_fields.applicable_accessibilities = private |
| 79 | + |
| 80 | +dotnet_naming_style.private_fields.capitalization = camel_case |
| 81 | +dotnet_naming_style.private_fields.required_prefix = _ |
| 82 | + |
| 83 | +# Locals and parameters are camel case |
| 84 | +dotnet_naming_rule.locals.severity = suggestion |
| 85 | +dotnet_naming_rule.locals.symbols = locals |
| 86 | +dotnet_naming_rule.locals.style = locals |
| 87 | + |
| 88 | +dotnet_naming_symbols.locals.applicable_kinds = parameter, local |
| 89 | + |
| 90 | +dotnet_naming_style.locals.capitalization = camel_case |
| 91 | + |
| 92 | +# Local functions are pascal case |
| 93 | +dotnet_naming_rule.local_functions.severity = suggestion |
| 94 | +dotnet_naming_rule.local_functions.symbols = local_functions |
| 95 | +dotnet_naming_rule.local_functions.style = local_functions |
| 96 | + |
| 97 | +dotnet_naming_symbols.local_functions.applicable_kinds = local_function |
| 98 | + |
| 99 | +dotnet_naming_style.local_functions.capitalization = pascal_case |
| 100 | + |
| 101 | +# Public members always pascal case |
| 102 | +dotnet_naming_rule.public_members_should_be_pascal_case.symbols = public_members |
| 103 | +dotnet_naming_rule.public_members_should_be_pascal_case.style = public_members |
| 104 | +dotnet_naming_rule.public_members_should_be_pascal_case.severity = suggestion |
| 105 | + |
| 106 | +dotnet_naming_symbols.public_members.applicable_kinds = property,method,field,event,delegate |
| 107 | +dotnet_naming_symbols.public_members.applicable_accessibilities = public |
| 108 | + |
| 109 | +dotnet_naming_style.public_members.capitalization = pascal_case |
| 110 | + |
| 111 | +dotnet_style_qualification_for_field = false:error |
| 112 | +dotnet_style_qualification_for_property = false:error |
| 113 | +dotnet_style_qualification_for_method = false:error |
| 114 | +dotnet_style_qualification_for_event = false:error |
| 115 | + |
| 116 | +# Use language keywords instead of framework type names for type references |
| 117 | +dotnet_style_predefined_type_for_locals_parameters_members = true:error |
| 118 | +dotnet_style_predefined_type_for_member_access = true:error |
| 119 | + |
| 120 | +# Suggest more modern language features when available |
| 121 | +dotnet_style_object_initializer = true:error |
| 122 | +dotnet_style_collection_initializer = true:error |
| 123 | +dotnet_style_explicit_tuple_names = true:error |
| 124 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:error |
| 125 | +dotnet_style_prefer_inferred_tuple_names = true:error |
| 126 | +dotnet_style_coalesce_expression = true:error |
| 127 | +dotnet_style_null_propagation = true:error |
| 128 | + |
| 129 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:error |
| 130 | +dotnet_style_readonly_field = true:error |
| 131 | + |
| 132 | +# CSharp code style settings: |
| 133 | +[*.cs] |
| 134 | +# Prefer "var" everywhere |
| 135 | +csharp_style_var_for_built_in_types = true:error |
| 136 | +csharp_style_var_when_type_is_apparent = true:error |
| 137 | +csharp_style_var_elsewhere = true:error |
| 138 | + |
| 139 | +csharp_style_expression_bodied_methods = true:suggestion |
| 140 | +csharp_style_expression_bodied_constructors = true:suggestion |
| 141 | +csharp_style_expression_bodied_operators = true:suggestion |
| 142 | +csharp_style_expression_bodied_properties = true:suggestion |
| 143 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 144 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 145 | + |
| 146 | +# Suggest more modern language features when available |
| 147 | +csharp_style_pattern_matching_over_is_with_cast_check = true:error |
| 148 | +csharp_style_pattern_matching_over_as_with_null_check = true:error |
| 149 | +csharp_style_inlined_variable_declaration = true:error |
| 150 | +csharp_style_deconstructed_variable_declaration = true:error |
| 151 | +csharp_style_pattern_local_over_anonymous_function = true:error |
| 152 | +csharp_style_throw_expression = true:error |
| 153 | +csharp_style_conditional_delegate_call = true:error |
| 154 | + |
| 155 | +csharp_prefer_braces = false:warning |
| 156 | +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error |
| 157 | + |
| 158 | +# --- |
| 159 | +# formatting conventions https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#formatting-conventions |
| 160 | + |
| 161 | +# Newline settings (Allman yo!) |
| 162 | +csharp_new_line_before_open_brace = all |
| 163 | +csharp_new_line_before_else = true |
| 164 | +csharp_new_line_before_catch = true |
| 165 | +csharp_new_line_before_finally = true |
| 166 | +csharp_new_line_before_members_in_object_initializers = true |
| 167 | +# just a suggestion do to our JSON tests that use anonymous types to |
| 168 | +# represent json quite a bit (makes copy paste easier). |
| 169 | +csharp_new_line_before_members_in_anonymous_types = true |
| 170 | +csharp_new_line_between_query_expression_clauses = true |
| 171 | + |
| 172 | +# Indent |
| 173 | +csharp_indent_case_contents = true |
| 174 | +csharp_indent_switch_labels = true |
| 175 | +csharp_space_after_cast = false |
| 176 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 177 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 178 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 179 | + |
| 180 | +#Wrap |
| 181 | +csharp_preserve_single_line_statements = false |
| 182 | +csharp_preserve_single_line_blocks = true |
| 183 | + |
| 184 | +# Resharper |
| 185 | +resharper_csharp_braces_for_lock=required_for_multiline |
| 186 | +resharper_csharp_braces_for_using=required_for_multiline |
| 187 | +resharper_csharp_braces_for_while=required_for_multiline |
| 188 | +resharper_csharp_braces_for_foreach=required_for_multiline |
| 189 | +resharper_csharp_braces_for_for=required_for_multiline |
| 190 | +resharper_csharp_braces_for_fixed=required_for_multiline |
| 191 | +resharper_csharp_braces_for_ifelse=required_for_multiline |
| 192 | + |
| 193 | +resharper_csharp_accessor_owner_body=expression_body |
| 194 | + |
| 195 | +resharper_redundant_case_label_highlighting=do_not_show |
| 196 | +resharper_redundant_argument_default_value_highlighting=do_not_show |
| 197 | +resharper_explicit_caller_info_argument_highlighting=hint |
| 198 | + |
| 199 | +dotnet_diagnostic.IDE0057.severity = none |
| 200 | + |
| 201 | +[*.{sh,bat,ps1}] |
| 202 | +trim_trailing_whitespace=true |
| 203 | +insert_final_newline=true |
| 204 | + |
| 205 | +[*.sh] |
| 206 | +end_of_line = lf |
| 207 | + |
| 208 | +[{LICENSE,NOTICE}] |
| 209 | +end_of_line = lf |
0 commit comments