|
| 1 | +# EditorConfig is awesome: http://EditorConfig.org |
| 2 | + |
| 3 | +# indent_style : { tab | space } |
| 4 | +# indent_size : { integer | tab } |
| 5 | +# tab_width : { integer (defaults "indent_size" when "indent_size" is a number) } |
| 6 | +# end_of_line : { lf | cr | crlf } |
| 7 | +# charset : { latin1 | utf-8 | utf-16be | utf-16le } |
| 8 | +# trim_trailing_whitespace : { true | false } |
| 9 | +# insert_final_newline : { true | false } |
| 10 | +# max_line_length : { integer } |
| 11 | + |
| 12 | +# top-most EditorConfig file |
| 13 | +root = true |
| 14 | + |
| 15 | +[*] |
| 16 | +end_of_line = crlf |
| 17 | +insert_final_newline = true |
| 18 | +indent_style = space |
| 19 | +indent_size = 2 |
| 20 | +charset = utf-8-bom |
| 21 | +trim_trailing_whitespace = true |
| 22 | +tab_width = 2 |
| 23 | +dotnet_style_operator_placement_when_wrapping = beginning_of_line |
| 24 | +dotnet_style_coalesce_expression = true:suggestion |
| 25 | +dotnet_style_null_propagation = true:suggestion |
| 26 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion |
| 27 | +dotnet_style_prefer_auto_properties = true:warning |
| 28 | +dotnet_style_object_initializer = true:warning |
| 29 | +dotnet_style_collection_initializer = true:warning |
| 30 | +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion |
| 31 | +dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion |
| 32 | +dotnet_style_prefer_conditional_expression_over_return = false:suggestion |
| 33 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 34 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 35 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 36 | +dotnet_style_prefer_compound_assignment = true:warning |
| 37 | +dotnet_style_prefer_simplified_interpolation = true:suggestion |
| 38 | +dotnet_style_namespace_match_folder = true:suggestion |
| 39 | + |
| 40 | +[*.{yaml,yml}] |
| 41 | +charset = utf-8 |
| 42 | + |
| 43 | +[*.cs] |
| 44 | +indent_size = 4 |
| 45 | +tab_width = 4 |
| 46 | +################################################# |
| 47 | +# Настройки серьёзности диагностик |
| 48 | +################################################# |
| 49 | + |
| 50 | + |
| 51 | +# IDE0051: Remove unused private members |
| 52 | +dotnet_diagnostic.IDE0051.severity = warning |
| 53 | +# IDE0052: Remove unread private members |
| 54 | +dotnet_diagnostic.IDE0052.severity = warning |
| 55 | + |
| 56 | +# использование this только если это требуется для однозначности (поля, свойства, методыб события) |
| 57 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#this-and-me |
| 58 | +dotnet_style_qualification_for_field = false:error |
| 59 | +dotnet_style_qualification_for_property = false:error |
| 60 | +dotnet_style_qualification_for_method = false:error |
| 61 | +dotnet_style_qualification_for_event = false:error |
| 62 | + |
| 63 | +# всегда использовать стандартные типы С# (unt вместо Int32) |
| 64 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#language-keywords |
| 65 | +dotnet_style_predefined_type_for_locals_parameters_members = true:warning |
| 66 | +dotnet_style_predefined_type_for_member_access = true:warning |
| 67 | + |
| 68 | +# всегда указывать модификатор доступа и readonly для неизменяемых полей |
| 69 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#normalize-modifiers |
| 70 | +dotnet_style_require_accessibility_modifiers = always:warning |
| 71 | +dotnet_style_readonly_field = true:warning |
| 72 | + |
| 73 | +# Свойства выражений |
| 74 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-level-preferences |
| 75 | +# Предупреждать если не используется инициализаторы объектов new Class{ Prop = 1 }; |
| 76 | +dotnet_style_object_initializer = true:warning |
| 77 | +# Предупреждать если не используется инициализаторы коллекций new List<int>{ 1 }; |
| 78 | +dotnet_style_collection_initializer = true:warning |
| 79 | +# Использование именнованных кортежей |
| 80 | +# dotnet_style_explicit_tuple_names = true:warning |
| 81 | +# dotnet_style_prefer_inferred_tuple_names = true:warning |
| 82 | +# Предупреждать если не используются авто-свойства Prop { get; } |
| 83 | +dotnet_style_prefer_auto_properties = true:warning |
| 84 | +# Предупреждать если используется if/else вместо тернарного оператора ?: при присвоении |
| 85 | +dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion |
| 86 | +# То же свамое, но для ретурн |
| 87 | +dotnet_style_prefer_conditional_expression_over_return = false:suggestion |
| 88 | +# предупреждать если можно использовать составное присвоение (+=, -= и т.д.) |
| 89 | +dotnet_style_prefer_compound_assignment = true:warning |
| 90 | + |
| 91 | +# Проверки на null |
| 92 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#null-checking-preferences |
| 93 | +# Предупреждать если не используется оператор ?? |
| 94 | +#dotnet_style_coalesce_expression = true:warning |
| 95 | +# предупреждать если не используется оператор ?. |
| 96 | +#dotnet_style_null_propagation = true:warning |
| 97 | + |
| 98 | +# Ошибка если есть неиспользуемые параметры |
| 99 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#parameter-preferences |
| 100 | +dotnet_code_quality_unused_parameters = all:error |
| 101 | + |
| 102 | +# При переносе строки оперетор должен размещаться на следующей строке: if(true <перенос> && true) |
| 103 | +# https://github.com/MicrosoftDocs/visualstudio-docs/issues/3641 |
| 104 | +dotnet_style_operator_placement_when_wrapping = beginning_of_line |
| 105 | + |
| 106 | +# Выведение типов |
| 107 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#implicit-and-explicit-types |
| 108 | +# Предупреждать если не используется var при инициализации стандартных типов |
| 109 | +csharp_style_var_for_built_in_types = true:warning |
| 110 | +# Предупреждать если не используется var если тип указан в правой части выражения |
| 111 | +csharp_style_var_when_type_is_apparent = true:warning |
| 112 | +# Использовать var в остальных случаях |
| 113 | +#csharp_style_var_elsewhere = true:warning |
| 114 | + |
| 115 | +# Expression-bodied members |
| 116 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-bodied-members |
| 117 | +# при генерации методов используем упрощенное написание, но не требуем |
| 118 | +csharp_style_expression_bodied_methods = true:none |
| 119 | +# стрелочные конструкторы не используем |
| 120 | +csharp_style_expression_bodied_constructors = false:silent |
| 121 | +# для операторов |
| 122 | +csharp_style_expression_bodied_operators = true:silent |
| 123 | +# для свойств когда только get (int Prop => 1) |
| 124 | +csharp_style_expression_bodied_properties = true:silent |
| 125 | +# для индексаторов |
| 126 | +csharp_style_expression_bodied_indexers = true:silent |
| 127 | +# для акцессоров свойств |
| 128 | +csharp_style_expression_bodied_accessors = when_on_single_line:warning |
| 129 | +# для лямбда-выражений |
| 130 | +csharp_style_expression_bodied_lambdas = true:warning |
| 131 | +# для локальных функций |
| 132 | +csharp_style_expression_bodied_local_functions = when_on_single_line:warning |
| 133 | + |
| 134 | +# Сопоставление с образцом |
| 135 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#pattern-matching |
| 136 | +# Предупреждать если не исползуется сопоставление типов при последующем приведении к типу (variable is int i) |
| 137 | +csharp_style_pattern_matching_over_is_with_cast_check = true:warning |
| 138 | +# Предупреждать если выражение as может заменено |
| 139 | +csharp_style_pattern_matching_over_as_with_null_check = true:warning |
| 140 | + |
| 141 | +# Встроенное объявление out переменной |
| 142 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#inlined-variable-declarations |
| 143 | +csharp_style_inlined_variable_declaration = true:warning |
| 144 | + |
| 145 | +# Выведение типа для оператора default |
| 146 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-level-preferences |
| 147 | +csharp_prefer_simple_default_expression = true:warning |
| 148 | + |
| 149 | +# "Null" checking preferences |
| 150 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-null-checking-preferences |
| 151 | +# Предупреждать если можно упростить проверку на null с выбросом исключения |
| 152 | +csharp_style_throw_expression = true:warning |
| 153 | +# Предупреждать если можно упростить проверку на null вызова делегата |
| 154 | +csharp_style_conditional_delegate_call = true:warning |
| 155 | + |
| 156 | +# Всегда использовать блоки кода |
| 157 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#code-block-preferences |
| 158 | +csharp_prefer_braces = false:warning |
| 159 | + |
| 160 | +# Не используемые значения |
| 161 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#unused-value-preferences |
| 162 | +# если выражение возвращает значение которое не используется предлагать добаыить присвоение к подчеркиванию |
| 163 | +csharp_style_unused_value_expression_statement_preference = discard_variable:silent |
| 164 | +# Предупреждать если присваемая переменная не используется и она не является подчеркиванием |
| 165 | +csharp_style_unused_value_assignment_preference = discard_variable:warning |
| 166 | + |
| 167 | + |
| 168 | +# Miscellaneous preferences |
| 169 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#miscellaneous-preferences |
| 170 | +# Предпочитать локальные функции анонимным |
| 171 | +csharp_style_pattern_local_over_anonymous_function = true:silent |
| 172 | +# Директивы using размещать вне |
| 173 | +csharp_using_directive_placement = outside_namespace:warning |
| 174 | +# Локальные функции помечать как статические |
| 175 | +#csharp_prefer_static_local_function = true:warning |
| 176 | +# Предпочитать использовать простой using |
| 177 | +#csharp_prefer_simple_using_statement = false:warning |
| 178 | + |
| 179 | +########################################## |
| 180 | +# .NET Соглашения по форматированию |
| 181 | +# https://docs.microsoft.com/visualstudio/ide/editorconfig-code-style-settings-reference#formatting-conventions |
| 182 | +########################################## |
| 183 | + |
| 184 | +# При сортировке системные юзинги размещать вначале |
| 185 | +dotnet_sort_system_directives_first = true |
| 186 | + |
| 187 | +# открывающую фигурную скобку всегда размещать на новой строке |
| 188 | +csharp_new_line_before_open_brace = all |
| 189 | +# опереатор else должен размещаться на новой строке |
| 190 | +csharp_new_line_before_else = true |
| 191 | +# опереатор catch должен размещаться на новой строке |
| 192 | +csharp_new_line_before_catch = true |
| 193 | +# опереатор finally должен размещаться на новой строке |
| 194 | +csharp_new_line_before_finally = true |
| 195 | +# при инициализации объекта каждый член должен размещаться на новой строке |
| 196 | +csharp_new_line_before_members_in_object_initializers = true |
| 197 | +# то же только для анонимных типов |
| 198 | +csharp_new_line_before_members_in_anonymous_types = true |
| 199 | +# операторы выражения LINQ должны располагаться с новой строки |
| 200 | +csharp_new_line_between_query_expression_clauses = true |
| 201 | + |
| 202 | +############################### |
| 203 | +# Naming |
| 204 | +############################### |
| 205 | + |
| 206 | +# styles |
| 207 | +dotnet_naming_style.upper_style.capitalization = all_upper |
| 208 | + |
| 209 | +dotnet_naming_style.camel_prefix_underscore_style.capitalization = camel_case |
| 210 | +dotnet_naming_style.camel_prefix_underscore_style.required_prefix = _ |
| 211 | + |
| 212 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 213 | + |
| 214 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 215 | + |
| 216 | +# private static readonly |
| 217 | +dotnet_naming_rule.private_static_readonly_fields.symbols = private_static_readonly_fields |
| 218 | +dotnet_naming_rule.private_static_readonly_fields.style = upper_style |
| 219 | +dotnet_naming_rule.private_static_readonly_fields.severity = none |
| 220 | + |
| 221 | +dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field |
| 222 | +dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private |
| 223 | +dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static,readonly |
| 224 | + |
| 225 | +# private const |
| 226 | +dotnet_naming_rule.private_const.symbols = private_const |
| 227 | +dotnet_naming_rule.private_const.style = upper_style |
| 228 | +dotnet_naming_rule.private_const.severity = none |
| 229 | + |
| 230 | +dotnet_naming_symbols.private_const.applicable_kinds = field |
| 231 | +dotnet_naming_symbols.private_const.applicable_accessibilities = private |
| 232 | +dotnet_naming_symbols.private_const.required_modifiers = const |
| 233 | + |
| 234 | +# private fields |
| 235 | +dotnet_naming_rule.private_members_with_underscore.symbols = private_fields |
| 236 | +dotnet_naming_rule.private_members_with_underscore.style = camel_prefix_underscore_style |
| 237 | +dotnet_naming_rule.private_members_with_underscore.severity = warning |
| 238 | + |
| 239 | +dotnet_naming_symbols.private_fields.applicable_kinds = field |
| 240 | +dotnet_naming_symbols.private_fields.applicable_accessibilities = private |
| 241 | + |
| 242 | +# local variables |
| 243 | +dotnet_naming_rule.local_variable.symbols = local_variable |
| 244 | +dotnet_naming_rule.local_variable.style = camel_case_style |
| 245 | +dotnet_naming_rule.local_variable.severity = error |
| 246 | + |
| 247 | +dotnet_naming_symbols.local_variable.applicable_kinds = method |
| 248 | +dotnet_naming_symbols.local_variable.applicable_accessibilities = local |
| 249 | + |
| 250 | +# Function parameters |
| 251 | +dotnet_naming_symbols.parameters_group.applicable_kinds = parameter |
| 252 | +dotnet_naming_rule.parameters_rule.symbols = parameters_group |
| 253 | +dotnet_naming_rule.parameters_rule.style = camel_case_style |
| 254 | +dotnet_naming_rule.parameters_rule.severity = error |
| 255 | + |
| 256 | +# namespace, class, enum, struct, delegate, event, method, property |
| 257 | +dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property |
| 258 | +dotnet_naming_rule.element_rule.symbols = element_group |
| 259 | +dotnet_naming_rule.element_rule.style = pascal_case_style |
| 260 | +dotnet_naming_rule.element_rule.severity = error |
| 261 | +csharp_prefer_simple_using_statement = true:suggestion |
| 262 | +csharp_style_namespace_declarations = block_scoped:silent |
| 263 | +csharp_style_prefer_method_group_conversion = true:silent |
| 264 | +csharp_style_prefer_top_level_statements = true:silent |
| 265 | +csharp_indent_labels = one_less_than_current |
| 266 | + |
| 267 | +# diagnostics |
| 268 | +dotnet_diagnostic.SA0001.severity = none |
| 269 | +dotnet_diagnostic.SA1005.severity = silent |
| 270 | +dotnet_diagnostic.SA1015.severity = none |
| 271 | +dotnet_diagnostic.SA1024.severity = none |
| 272 | +dotnet_diagnostic.SA1101.severity = silent |
| 273 | +dotnet_diagnostic.SA1116.severity = none |
| 274 | +dotnet_diagnostic.SA1118.severity = silent |
| 275 | +dotnet_diagnostic.SA1200.severity = none |
| 276 | +dotnet_diagnostic.SA1309.severity = none |
| 277 | +dotnet_diagnostic.SA1310.severity = none |
| 278 | +dotnet_diagnostic.SA1311.severity = none |
| 279 | +dotnet_diagnostic.SA1503.severity = none |
| 280 | +dotnet_diagnostic.SA1600.severity = none |
| 281 | +dotnet_diagnostic.SA1623.severity = none |
| 282 | +dotnet_diagnostic.SA1633.severity = silent |
| 283 | +dotnet_diagnostic.SA1642.severity = none |
| 284 | + |
| 285 | +dotnet_diagnostic.NUnit2001.severity = silent |
| 286 | +dotnet_diagnostic.NUnit2002.severity = silent |
| 287 | +dotnet_diagnostic.NUnit2003.severity = silent |
| 288 | +dotnet_diagnostic.NUnit2004.severity = silent |
| 289 | +dotnet_diagnostic.NUnit2005.severity = silent |
| 290 | +dotnet_diagnostic.NUnit2006.severity = silent |
0 commit comments