|
| 1 | +############################### |
| 2 | +# Core EditorConfig Options # |
| 3 | +############################### |
| 4 | +root = true |
| 5 | + |
| 6 | +# All files |
| 7 | +[*] |
| 8 | +indent_style = space |
| 9 | +file_header_template = This file is part of the DSharpPlus project.\n\nCopyright (c) 2015 Mike Santiago\nCopyright (c) 2016-2022 DSharpPlus Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE. |
| 10 | + |
| 11 | +# XML project files |
| 12 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] |
| 13 | +indent_size = 2 |
| 14 | + |
| 15 | +# XML config files |
| 16 | +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] |
| 17 | +indent_size = 2 |
| 18 | + |
| 19 | +# Code files |
| 20 | +[*.cs] |
| 21 | +indent_size = 4 |
| 22 | +insert_final_newline = true |
| 23 | +charset = utf-8 |
| 24 | + |
| 25 | +############################### |
| 26 | +# .NET Coding Conventions # |
| 27 | +############################### |
| 28 | +[*.{cs,vb}] |
| 29 | + |
| 30 | +# Organize usings |
| 31 | +dotnet_sort_system_directives_first = true:error |
| 32 | +# Using directive is unnecessary. |
| 33 | +dotnet_diagnostic.IDE0005.severity = error |
| 34 | + |
| 35 | +# Yell at people when they don't include the file header template |
| 36 | +dotnet_diagnostic.IDE0073.severity = error |
| 37 | + |
| 38 | +# this. preferences |
| 39 | +dotnet_style_qualification_for_field = false:error |
| 40 | +dotnet_style_qualification_for_property = false:error |
| 41 | +dotnet_style_qualification_for_method = false:error |
| 42 | +dotnet_style_qualification_for_event = false:error |
| 43 | + |
| 44 | +# Language keywords vs BCL types preferences |
| 45 | +dotnet_style_predefined_type_for_locals_parameters_members = true:error |
| 46 | +dotnet_style_predefined_type_for_member_access = true:error |
| 47 | + |
| 48 | +# Parentheses preferences |
| 49 | +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:error |
| 50 | +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:error |
| 51 | +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:error |
| 52 | +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:error |
| 53 | + |
| 54 | +# Modifier preferences |
| 55 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:error |
| 56 | +dotnet_style_readonly_field = true:error |
| 57 | + |
| 58 | +# Expression-level preferences |
| 59 | +dotnet_style_object_initializer = true:error |
| 60 | +dotnet_style_collection_initializer = true:error |
| 61 | +dotnet_style_explicit_tuple_names = true:error |
| 62 | +dotnet_style_null_propagation = true:error |
| 63 | +dotnet_style_coalesce_expression = true:error |
| 64 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error |
| 65 | +dotnet_style_prefer_inferred_tuple_names = true:error |
| 66 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:error |
| 67 | +dotnet_style_prefer_auto_properties = true:error |
| 68 | +dotnet_style_prefer_conditional_expression_over_assignment = true:error |
| 69 | +dotnet_style_prefer_conditional_expression_over_return = true:error |
| 70 | + |
| 71 | +############################### |
| 72 | +# Naming Conventions # |
| 73 | +############################### |
| 74 | + |
| 75 | +# Style Definitions |
| 76 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 77 | + |
| 78 | +# Use PascalCase for constant fields |
| 79 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = error |
| 80 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields |
| 81 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style |
| 82 | +dotnet_naming_symbols.constant_fields.applicable_kinds = field |
| 83 | +dotnet_naming_symbols.constant_fields.applicable_accessibilities = * |
| 84 | +dotnet_naming_symbols.constant_fields.required_modifiers = const |
| 85 | + |
| 86 | +# Interfaces should start with I |
| 87 | +dotnet_naming_rule.interface_should_be_begins_with_i.severity = error |
| 88 | +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface |
| 89 | +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i |
| 90 | +dotnet_naming_style.begins_with_i.required_prefix = I |
| 91 | +dotnet_naming_style.begins_with_i.capitalization = pascal_case |
| 92 | +dotnet_naming_symbols.interface.applicable_kinds = interface |
| 93 | + |
| 94 | +# Async Methods should end with Async |
| 95 | +dotnet_naming_rule.async_methods_should_be_async_suffix.severity = error |
| 96 | +dotnet_naming_rule.async_methods_should_be_async_suffix.symbols = async_methods |
| 97 | +dotnet_naming_rule.async_methods_should_be_async_suffix.style = async_suffix |
| 98 | +dotnet_naming_style.async_suffix.required_suffix = Async |
| 99 | +dotnet_naming_style.async_suffix.capitalization = pascal_case |
| 100 | +dotnet_naming_symbols.async_methods.applicable_kinds = method |
| 101 | +dotnet_naming_symbols.async_methods.required_modifiers = async |
| 102 | + |
| 103 | +# Don't force namespaces to match their folder names |
| 104 | +dotnet_diagnostic.IDE0130.severity = none |
| 105 | +# Force using directives to be outside of namespace declarations |
| 106 | +csharp_using_directive_placement = outside_namespace:error |
| 107 | + |
| 108 | +# Not all values need to be used. |
| 109 | +dotnet_diagnostic.IDE0058.severity = none |
| 110 | + |
| 111 | +############################### |
| 112 | +# C# Coding Conventions # |
| 113 | +############################### |
| 114 | +[*.cs] |
| 115 | + |
| 116 | +# var preferences |
| 117 | +csharp_style_var_for_built_in_types = false:error |
| 118 | +csharp_style_var_when_type_is_apparent = false:error |
| 119 | +csharp_style_var_elsewhere = false:error |
| 120 | + |
| 121 | +# Expression-bodied members |
| 122 | +csharp_style_expression_bodied_methods = true:error |
| 123 | +csharp_style_expression_bodied_constructors = true:error |
| 124 | +csharp_style_expression_bodied_operators = true:error |
| 125 | +csharp_style_expression_bodied_properties = true:error |
| 126 | +csharp_style_expression_bodied_indexers = true:error |
| 127 | +csharp_style_expression_bodied_accessors = true:error |
| 128 | +csharp_style_expression_bodied_lambdas = true:warning |
| 129 | + |
| 130 | +# Pattern matching preferences |
| 131 | +csharp_style_pattern_matching_over_is_with_cast_check = true:error |
| 132 | +csharp_style_pattern_matching_over_as_with_null_check = true:error |
| 133 | + |
| 134 | +# Null-checking preferences |
| 135 | +csharp_style_throw_expression = true:error |
| 136 | +csharp_style_conditional_delegate_call = true:error |
| 137 | + |
| 138 | +# Modifier preferences |
| 139 | +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error |
| 140 | + |
| 141 | +# Expression-level preferences |
| 142 | +csharp_prefer_braces = true:error |
| 143 | +csharp_style_deconstructed_variable_declaration = true:error |
| 144 | +csharp_prefer_simple_default_expression = true:error |
| 145 | +csharp_style_pattern_local_over_anonymous_function = true:error |
| 146 | +csharp_style_inlined_variable_declaration = true:error |
| 147 | + |
| 148 | +############################### |
| 149 | +# C# Formatting Rules # |
| 150 | +############################### |
| 151 | + |
| 152 | +# New line preferences |
| 153 | +csharp_new_line_before_open_brace = all |
| 154 | +csharp_new_line_before_else = true |
| 155 | +csharp_new_line_before_catch = true |
| 156 | +csharp_new_line_before_finally = true |
| 157 | +csharp_new_line_before_members_in_object_initializers = true |
| 158 | +csharp_new_line_before_members_in_anonymous_types = true |
| 159 | +csharp_new_line_between_query_expression_clauses = true |
| 160 | + |
| 161 | +# Indentation preferences |
| 162 | +csharp_indent_case_contents = true |
| 163 | +csharp_indent_switch_labels = true |
| 164 | +csharp_indent_labels = flush_left |
| 165 | + |
| 166 | +# Space preferences |
| 167 | +csharp_space_after_cast = false |
| 168 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 169 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 170 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 171 | +csharp_space_between_parentheses = false |
| 172 | +csharp_space_before_colon_in_inheritance_clause = true |
| 173 | +csharp_space_after_colon_in_inheritance_clause = true |
| 174 | +csharp_space_around_binary_operators = before_and_after |
| 175 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 176 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 177 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 178 | + |
| 179 | +# Wrapping preferences |
| 180 | +csharp_preserve_single_line_statements = true |
| 181 | +csharp_preserve_single_line_blocks = true |
0 commit comments