|
| 1 | +# EditorConfig is awesome: https://EditorConfig.org |
| 2 | + |
| 3 | +# top-most EditorConfig file |
| 4 | +root = true |
| 5 | + |
| 6 | +# Default settings: |
| 7 | +# A newline ending every file |
| 8 | +# Use 4 spaces as indentation |
| 9 | +[*] |
| 10 | +insert_final_newline = true |
| 11 | +indent_style = space |
| 12 | +indent_size = 4 |
| 13 | +trim_trailing_whitespace = true |
| 14 | + |
| 15 | +# C# files |
| 16 | +[*.cs] |
| 17 | +charset = utf-8 |
| 18 | + |
| 19 | +# New line preferences |
| 20 | +csharp_new_line_before_open_brace = all |
| 21 | +csharp_new_line_before_else = true |
| 22 | +csharp_new_line_before_catch = true |
| 23 | +csharp_new_line_before_finally = true |
| 24 | +csharp_new_line_before_members_in_object_initializers = true |
| 25 | +csharp_new_line_before_members_in_anonymous_types = true |
| 26 | +csharp_new_line_between_query_expression_clauses = true |
| 27 | + |
| 28 | +# Indentation preferences |
| 29 | +csharp_indent_block_contents = true |
| 30 | +csharp_indent_braces = false |
| 31 | +csharp_indent_case_contents = true |
| 32 | +csharp_indent_case_contents_when_block = true |
| 33 | +csharp_indent_switch_labels = true |
| 34 | +csharp_indent_labels = one_less_than_current |
| 35 | + |
| 36 | +# Modifier preferences |
| 37 | +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion |
| 38 | + |
| 39 | +# avoid this. unless absolutely necessary |
| 40 | +dotnet_style_qualification_for_field = false:suggestion |
| 41 | +dotnet_style_qualification_for_property = false:suggestion |
| 42 | +dotnet_style_qualification_for_method = false:suggestion |
| 43 | +dotnet_style_qualification_for_event = false:suggestion |
| 44 | + |
| 45 | +# Types: use keywords instead of BCL types, and permit var only when the type is clear |
| 46 | +csharp_style_var_for_built_in_types = false:suggestion |
| 47 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 48 | +csharp_style_var_elsewhere = false:suggestion |
| 49 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 50 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 51 | + |
| 52 | +# name all constant fields using PascalCase |
| 53 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion |
| 54 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields |
| 55 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style |
| 56 | +dotnet_naming_symbols.constant_fields.applicable_kinds = field |
| 57 | +dotnet_naming_symbols.constant_fields.required_modifiers = const |
| 58 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 59 | + |
| 60 | +# static fields should have s_ prefix |
| 61 | +dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion |
| 62 | +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields |
| 63 | +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style |
| 64 | +dotnet_naming_symbols.static_fields.applicable_kinds = field |
| 65 | +dotnet_naming_symbols.static_fields.required_modifiers = static |
| 66 | +dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected |
| 67 | +dotnet_naming_style.static_prefix_style.required_prefix = s_ |
| 68 | +dotnet_naming_style.static_prefix_style.capitalization = camel_case |
| 69 | + |
| 70 | +# internal and private fields should be _camelCase |
| 71 | +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion |
| 72 | +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields |
| 73 | +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style |
| 74 | +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field |
| 75 | +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal |
| 76 | +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ |
| 77 | +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case |
| 78 | + |
| 79 | +# Code style defaults |
| 80 | +csharp_using_directive_placement = outside_namespace:suggestion |
| 81 | +dotnet_sort_system_directives_first = true |
| 82 | +csharp_prefer_braces = true:suggestion |
| 83 | +csharp_preserve_single_line_blocks = true:none |
| 84 | +csharp_preserve_single_line_statements = false:none |
| 85 | +csharp_prefer_static_local_function = true:suggestion |
| 86 | +csharp_prefer_simple_using_statement = false:none |
| 87 | +csharp_style_prefer_switch_expression = true:suggestion |
| 88 | +dotnet_style_readonly_field = true:suggestion |
| 89 | + |
| 90 | +# Expression-level preferences |
| 91 | +dotnet_style_object_initializer = true:suggestion |
| 92 | +dotnet_style_collection_initializer = true:suggestion |
| 93 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 94 | +dotnet_style_coalesce_expression = true:suggestion |
| 95 | +dotnet_style_null_propagation = true:suggestion |
| 96 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion |
| 97 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 98 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 99 | +dotnet_style_prefer_auto_properties = true:suggestion |
| 100 | +dotnet_style_prefer_conditional_expression_over_assignment = true:silent |
| 101 | +dotnet_style_prefer_conditional_expression_over_return = true:silent |
| 102 | +csharp_prefer_simple_default_expression = true:suggestion |
| 103 | + |
| 104 | +# XML project files |
| 105 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] |
| 106 | +indent_size = 2 |
| 107 | + |
| 108 | +# XML config files |
| 109 | +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] |
| 110 | +indent_size = 2 |
| 111 | + |
| 112 | +# YAML config files |
| 113 | +[*.{yml,yaml}] |
| 114 | +indent_size = 2 |
| 115 | + |
| 116 | +# JSON files |
| 117 | +[*.json] |
| 118 | +indent_size = 2 |
| 119 | + |
| 120 | +# Shell scripts |
| 121 | +[*.sh] |
| 122 | +end_of_line = lf |
| 123 | + |
| 124 | +[*.{cmd,bat}] |
| 125 | +end_of_line = crlf |
0 commit comments