|
| 1 | +; EditorConfig to support per-solution formatting. |
| 2 | +; Use the EditorConfig VS add-in to make this work. |
| 3 | +; http://editorconfig.org/ |
| 4 | +; |
| 5 | +; Here are some resources for what's supported for .NET/C# |
| 6 | +; https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers |
| 7 | +; https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017 |
| 8 | +; |
| 9 | +; Be **careful** editing this because some of the rules don't support adding a severity level |
| 10 | +; For instance if you change to `dotnet_sort_system_directives_first = true:warning` (adding `:warning`) |
| 11 | +; then the rule will be silently ignored. |
| 12 | + |
| 13 | +root = true |
| 14 | + |
| 15 | +[*] |
| 16 | +indent_style = space |
| 17 | +charset = utf-8 |
| 18 | +trim_trailing_whitespace = true |
| 19 | +insert_final_newline = true |
| 20 | + |
| 21 | +[*.cs] |
| 22 | +indent_size = 4 |
| 23 | +max_line_length = 120 |
| 24 | + |
| 25 | +# 'using' directive preferences |
| 26 | +dotnet_sort_system_directives_first = true |
| 27 | +dotnet_separate_import_directive_groups = false |
| 28 | + |
| 29 | +# Code-block preferences |
| 30 | +csharp_prefer_braces = true:suggestion |
| 31 | +csharp_prefer_simple_using_statement = true:suggestion |
| 32 | + |
| 33 | +# Don't use this. qualifier |
| 34 | +dotnet_style_qualification_for_event = false:suggestion |
| 35 | +dotnet_style_qualification_for_field = false:suggestion |
| 36 | +dotnet_style_qualification_for_method = false:suggestion |
| 37 | +dotnet_style_qualification_for_property = false:suggestion |
| 38 | + |
| 39 | +# Use int x = .. over Int32 |
| 40 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 41 | + |
| 42 | +# Use int.MaxValue over Int32.MaxValue |
| 43 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 44 | + |
| 45 | +# Require var all the time. |
| 46 | +csharp_style_var_for_built_in_types = true:suggestion |
| 47 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 48 | +csharp_style_var_elsewhere = true:suggestion |
| 49 | + |
| 50 | +# Disallow throw expressions. |
| 51 | +csharp_style_throw_expression = false:suggestion |
| 52 | + |
| 53 | +# Newline settings |
| 54 | +csharp_new_line_before_open_brace = all |
| 55 | +csharp_new_line_before_else = true |
| 56 | +csharp_new_line_before_catch = true |
| 57 | +csharp_new_line_before_finally = true |
| 58 | +csharp_new_line_before_members_in_object_initializers = true |
| 59 | +csharp_new_line_before_members_in_anonymous_types = true |
| 60 | +resharper_place_attribute_on_same_line = false |
| 61 | + |
| 62 | +# Naming |
| 63 | +dotnet_naming_rule.private_constants_rule.severity = warning |
| 64 | +dotnet_naming_rule.private_constants_rule.style = pascal_case_style |
| 65 | +dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols |
| 66 | +dotnet_naming_rule.private_instance_fields_rule.severity = warning |
| 67 | +dotnet_naming_rule.private_instance_fields_rule.style = _camel_case_style |
| 68 | +dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols |
| 69 | +dotnet_naming_rule.private_static_fields_rule.severity = warning |
| 70 | +dotnet_naming_rule.private_static_fields_rule.style = _camel_case_style |
| 71 | +dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols |
| 72 | +dotnet_naming_rule.private_static_readonly_rule.severity = warning |
| 73 | +dotnet_naming_rule.private_static_readonly_rule.style = _camel_case_style |
| 74 | +dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols |
| 75 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 76 | +dotnet_naming_style._camel_case_style.capitalization = camel_case |
| 77 | +dotnet_naming_style._camel_case_style.required_prefix = _ |
| 78 | +dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private |
| 79 | +dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field |
| 80 | +dotnet_naming_symbols.private_constants_symbols.required_modifiers = const |
| 81 | +dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private |
| 82 | +dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field |
| 83 | +dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private |
| 84 | +dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field |
| 85 | +dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static |
| 86 | +dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private |
| 87 | +dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field |
| 88 | +dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static, readonly |
| 89 | + |
| 90 | +[*.{xml, yml, yaml, json, proto, config, *proj, nuspec, props, resx, targets, tasks}] |
| 91 | +indent_size = 2 |
| 92 | + |
| 93 | +[*.{ps1, psm1}] |
| 94 | +indent_size = 4 |
| 95 | + |
| 96 | +[*.sh] |
| 97 | +indent_size = 4 |
| 98 | +end_of_line = lf |
0 commit comments