|
| 1 | +# EditorConfig is awesome: http://EditorConfig.org |
| 2 | +# Based on: https://github.com/dotnet/roslyn/blob/master/.editorconfig |
| 3 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference |
| 4 | +# https://www.jetbrains.com/help/rider/Using_EditorConfig.html?Wave=183 |
| 5 | + |
| 6 | +root = true |
| 7 | + |
1 | 8 | [*] |
2 | 9 | charset = utf-8 |
3 | 10 | end_of_line = lf |
4 | 11 | indent_style = space |
5 | 12 | max_line_length = 180 |
6 | 13 | insert_final_newline = true |
7 | 14 |
|
8 | | -[*.cs] |
9 | | -indent_size = 4 |
10 | | -# code style settings: |
11 | | -dotnet_sort_system_directives_first = true |
12 | | - |
13 | | -[*.csproj] |
| 15 | +# XML |
| 16 | +[{*.csproj, *.props, .ruleset}] |
14 | 17 | indent_size = 2 |
15 | 18 |
|
16 | | -[{*.yml,*.yaml}] |
| 19 | +[{*.yml, *.yaml}] |
17 | 20 | indent_size = 2 |
18 | 21 |
|
19 | 22 | [*.json] |
20 | 23 | indent_size = 2 |
21 | 24 |
|
22 | 25 | [{*.sh, *.ps1}] |
23 | 26 | indent_size = 2 |
| 27 | + |
| 28 | +[*.cs] |
| 29 | +indent_size = 4 |
| 30 | + |
| 31 | +## Dotnet code style settings: |
| 32 | + |
| 33 | +# Sort using and Import directives with System.* appearing first |
| 34 | +dotnet_sort_system_directives_first = true |
| 35 | +# Avoid "this." and "Me." if not necessary |
| 36 | +dotnet_style_qualification_for_field = false:suggestion |
| 37 | +dotnet_style_qualification_for_property = false:suggestion |
| 38 | +dotnet_style_qualification_for_method = false:suggestion |
| 39 | +dotnet_style_qualification_for_event = false:suggestion |
| 40 | + |
| 41 | +# Use language keywords instead of framework type names for type references |
| 42 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 43 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 44 | + |
| 45 | +# Suggest more modern language features when available |
| 46 | +dotnet_style_object_initializer = true:suggestion |
| 47 | +dotnet_style_collection_initializer = true:suggestion |
| 48 | +dotnet_style_coalesce_expression = true:suggestion |
| 49 | +dotnet_style_null_propagation = true:suggestion |
| 50 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 51 | + |
| 52 | +# CSharp code style settings: |
| 53 | + |
| 54 | +# Prefer "var" everywhere |
| 55 | +csharp_style_var_for_built_in_types = false:none |
| 56 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 57 | +csharp_style_var_elsewhere = true:suggestion |
| 58 | + |
| 59 | +# Prefer method-like constructs to have a block body |
| 60 | +csharp_style_expression_bodied_methods = false:none |
| 61 | +csharp_style_expression_bodied_constructors = false:none |
| 62 | +csharp_style_expression_bodied_operators = false:none |
| 63 | + |
| 64 | +# Prefer property-like constructs to have an expression-body |
| 65 | +csharp_style_expression_bodied_properties = true:none |
| 66 | +csharp_style_expression_bodied_indexers = true:none |
| 67 | +csharp_style_expression_bodied_accessors = true:none |
| 68 | + |
| 69 | +# Suggest more modern language features when available |
| 70 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 71 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 72 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 73 | +csharp_style_throw_expression = true:suggestion |
| 74 | +csharp_style_conditional_delegate_call = true:suggestion |
| 75 | + |
| 76 | +# Newline settings |
| 77 | +csharp_new_line_before_else = true |
| 78 | +csharp_new_line_before_catch = true |
| 79 | +csharp_new_line_before_finally = true |
| 80 | +csharp_new_line_before_members_in_object_initializers = true |
| 81 | +csharp_new_line_before_members_in_anonymous_types = true |
| 82 | + |
| 83 | +## Naming |
| 84 | + |
| 85 | +dotnet_naming_style.underscore_prefix.capitalization = camel_case |
| 86 | +dotnet_naming_style.underscore_prefix.required_prefix = _ |
| 87 | + |
| 88 | +# private fields should be _camelCase |
| 89 | +dotnet_naming_rule.private_fields_with_underscore.symbols = private_fields |
| 90 | +dotnet_naming_rule.private_fields_with_underscore.style = underscore_prefix |
| 91 | +dotnet_naming_rule.private_fields_with_underscore.severity = suggestion |
| 92 | + |
| 93 | +dotnet_naming_symbols.private_fields.applicable_kinds = field |
| 94 | +dotnet_naming_symbols.private_fields.applicable_accessibilities = private |
0 commit comments