|
| 1 | +# 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 | +dotnet_style_operator_placement_when_wrapping = beginning_of_line |
| 14 | +tab_width = 4 |
| 15 | +end_of_line = crlf |
| 16 | +dotnet_style_coalesce_expression = true:suggestion |
| 17 | +dotnet_style_null_propagation = true:suggestion |
| 18 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion |
| 19 | +dotnet_style_prefer_auto_properties = true:silent |
| 20 | +dotnet_style_object_initializer = true:suggestion |
| 21 | +dotnet_style_collection_initializer = true:suggestion |
| 22 | +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion |
| 23 | +dotnet_style_prefer_conditional_expression_over_assignment = true:silent |
| 24 | +dotnet_style_prefer_conditional_expression_over_return = true:silent |
| 25 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 26 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 27 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 28 | +dotnet_style_prefer_compound_assignment = true:suggestion |
| 29 | +dotnet_style_prefer_simplified_interpolation = true:suggestion |
| 30 | +dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion |
| 31 | +dotnet_style_namespace_match_folder = true:suggestion |
| 32 | + |
| 33 | +# C# files |
| 34 | +[*.cs] |
| 35 | +# New line preferences |
| 36 | +csharp_new_line_before_open_brace = all |
| 37 | +csharp_new_line_before_else = true |
| 38 | +csharp_new_line_before_catch = true |
| 39 | +csharp_new_line_before_finally = true |
| 40 | +csharp_new_line_before_members_in_object_initializers = true |
| 41 | +csharp_new_line_before_members_in_anonymous_types = true |
| 42 | +csharp_new_line_between_query_expression_clauses = true |
| 43 | +# trim_trailing_whitespace = true |
| 44 | + |
| 45 | +# Indentation preferences |
| 46 | +csharp_indent_block_contents = true |
| 47 | +csharp_indent_braces = false |
| 48 | +csharp_indent_case_contents = true |
| 49 | +csharp_indent_switch_labels = true |
| 50 | +csharp_indent_labels = one_less_than_current |
| 51 | + |
| 52 | +# avoid this. unless absolutely necessary |
| 53 | +dotnet_style_qualification_for_field = false:suggestion |
| 54 | +dotnet_style_qualification_for_property = false:suggestion |
| 55 | +dotnet_style_qualification_for_method = false:suggestion |
| 56 | +dotnet_style_qualification_for_event = false:suggestion |
| 57 | + |
| 58 | +# prefer var |
| 59 | +csharp_style_var_for_built_in_types = true |
| 60 | +csharp_style_var_when_type_is_apparent = true |
| 61 | +csharp_style_var_elsewhere = true:suggestion |
| 62 | + |
| 63 | +# use language keywords instead of BCL types |
| 64 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 65 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 66 | + |
| 67 | +# name all constant fields using PascalCase |
| 68 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion |
| 69 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields |
| 70 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style |
| 71 | + |
| 72 | +dotnet_naming_symbols.constant_fields.applicable_kinds = field |
| 73 | +dotnet_naming_symbols.constant_fields.required_modifiers = const |
| 74 | + |
| 75 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 76 | + |
| 77 | +# private static fields should have s_ prefix |
| 78 | +dotnet_naming_rule.private_static_fields_should_have_prefix.severity = suggestion |
| 79 | +dotnet_naming_rule.private_static_fields_should_have_prefix.symbols = private_static_fields |
| 80 | +dotnet_naming_rule.private_static_fields_should_have_prefix.style = private_static_prefix_style |
| 81 | + |
| 82 | +dotnet_naming_symbols.private_static_fields.applicable_kinds = field |
| 83 | +dotnet_naming_symbols.private_static_fields.required_modifiers = static |
| 84 | +dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private |
| 85 | + |
| 86 | +dotnet_naming_style.private_static_prefix_style.required_prefix = s_ |
| 87 | +dotnet_naming_style.private_static_prefix_style.capitalization = camel_case |
| 88 | + |
| 89 | +# internal and private fields should be _camelCase |
| 90 | +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion |
| 91 | +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields |
| 92 | +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style |
| 93 | + |
| 94 | +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field |
| 95 | +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal |
| 96 | + |
| 97 | +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ |
| 98 | +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case |
| 99 | + |
| 100 | +# use accessibility modifiers |
| 101 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion |
| 102 | + |
| 103 | +# Code style defaults |
| 104 | +dotnet_sort_system_directives_first = true |
| 105 | +csharp_preserve_single_line_blocks = true |
| 106 | +csharp_preserve_single_line_statements = false |
| 107 | + |
| 108 | +# Expression-level preferences |
| 109 | +dotnet_style_object_initializer = true:suggestion |
| 110 | +dotnet_style_collection_initializer = true:suggestion |
| 111 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 112 | +dotnet_style_coalesce_expression = true:suggestion |
| 113 | +dotnet_style_null_propagation = true:suggestion |
| 114 | + |
| 115 | +# Expression-bodied members |
| 116 | +csharp_style_expression_bodied_methods = false:none |
| 117 | +csharp_style_expression_bodied_constructors = false:none |
| 118 | +csharp_style_expression_bodied_operators = false:none |
| 119 | +csharp_style_expression_bodied_properties = true:none |
| 120 | +csharp_style_expression_bodied_indexers = true:none |
| 121 | +csharp_style_expression_bodied_accessors = true:none |
| 122 | + |
| 123 | +# Pattern matching |
| 124 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 125 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 126 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 127 | + |
| 128 | +# Null checking preferences |
| 129 | +csharp_style_throw_expression = true:suggestion |
| 130 | +csharp_style_conditional_delegate_call = true:suggestion |
| 131 | + |
| 132 | +# Space preferences |
| 133 | +csharp_space_after_cast = false |
| 134 | +csharp_space_after_colon_in_inheritance_clause = true |
| 135 | +csharp_space_after_comma = true |
| 136 | +csharp_space_after_dot = false |
| 137 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 138 | +csharp_space_after_semicolon_in_for_statement = true |
| 139 | +csharp_space_around_binary_operators = before_and_after |
| 140 | +csharp_space_around_declaration_statements = false |
| 141 | +csharp_space_before_colon_in_inheritance_clause = true |
| 142 | +csharp_space_before_comma = false |
| 143 | +csharp_space_before_dot = false |
| 144 | +csharp_space_before_open_square_brackets = false |
| 145 | +csharp_space_before_semicolon_in_for_statement = false |
| 146 | +csharp_space_between_empty_square_brackets = false |
| 147 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 148 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 149 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 150 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 151 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 152 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 153 | +csharp_space_between_parentheses = false |
| 154 | +csharp_space_between_square_brackets = false |
| 155 | +space_within_single_line_array_initializer_braces = true |
| 156 | + |
| 157 | +#Net Analyzer |
| 158 | +dotnet_analyzer_diagnostic.category-Performance.severity = none #error - Uncomment when all violations are fixed. |
| 159 | + |
| 160 | +# CS0649: Field 'field' is never assigned to, and will always have its default value 'value' |
| 161 | +dotnet_diagnostic.CS0649.severity = error |
| 162 | + |
| 163 | +# CS1591: Missing XML comment for publicly visible type or member |
| 164 | +dotnet_diagnostic.CS1591.severity = suggestion |
| 165 | + |
| 166 | +# CS0162: Remove unreachable code |
| 167 | +dotnet_diagnostic.CS0162.severity = error |
| 168 | +# CA1018: Mark attributes with AttributeUsageAttribute |
| 169 | +dotnet_diagnostic.CA1018.severity = error |
| 170 | +# CA1304: Specify CultureInfo |
| 171 | +dotnet_diagnostic.CA1304.severity = warning |
| 172 | +# CA1802: Use literals where appropriate |
| 173 | +dotnet_diagnostic.CA1802.severity = warning |
| 174 | +# CA1813: Avoid unsealed attributes |
| 175 | +dotnet_diagnostic.CA1813.severity = error |
| 176 | +# CA1815: Override equals and operator equals on value types |
| 177 | +dotnet_diagnostic.CA1815.severity = warning |
| 178 | +# CA1820: Test for empty strings using string length |
| 179 | +dotnet_diagnostic.CA1820.severity = warning |
| 180 | +# CA1821: Remove empty finalizers |
| 181 | +dotnet_diagnostic.CA1821.severity = error |
| 182 | +# CA1822: Mark members as static |
| 183 | +dotnet_diagnostic.CA1822.severity = suggestion |
| 184 | +dotnet_code_quality.CA1822.api_surface = private, internal |
| 185 | +# CA1823: Avoid unused private fields |
| 186 | +dotnet_diagnostic.CA1823.severity = error |
| 187 | +# CA1825: Avoid zero-length array allocations |
| 188 | +dotnet_diagnostic.CA1825.severity = warning |
| 189 | +# CA1826: Use property instead of Linq Enumerable method |
| 190 | +dotnet_diagnostic.CA1826.severity = suggestion |
| 191 | +# CA1827: Do not use Count/LongCount when Any can be used |
| 192 | +dotnet_diagnostic.CA1827.severity = warning |
| 193 | +# CA1828: Do not use CountAsync/LongCountAsync when AnyAsync can be used |
| 194 | +dotnet_diagnostic.CA1828.severity = warning |
| 195 | +# CA1829: Use Length/Count property instead of Enumerable.Count method |
| 196 | +dotnet_diagnostic.CA1829.severity = warning |
| 197 | +#CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters |
| 198 | +dotnet_diagnostic.CA1847.severity = warning |
| 199 | +# CA1851: Possible multiple enumerations of IEnumerable collection |
| 200 | +dotnet_diagnostic.CA1851.severity = warning |
| 201 | +#CA1854: Prefer the IDictionary.TryGetValue(TKey, out TValue) method |
| 202 | +dotnet_diagnostic.CA1854.severity = warning |
| 203 | +#CA2211:Non-constant fields should not be visible |
| 204 | +dotnet_diagnostic.CA2211.severity = error |
| 205 | + |
| 206 | +# Wrapping preferences |
| 207 | +csharp_wrap_before_ternary_opsigns = false |
| 208 | + |
| 209 | +# Avalonia DevAnalyzer preferences |
| 210 | +dotnet_diagnostic.AVADEV2001.severity = error |
| 211 | + |
| 212 | +# Avalonia PublicAnalyzer preferences |
| 213 | +dotnet_diagnostic.AVP1000.severity = error |
| 214 | +dotnet_diagnostic.AVP1001.severity = error |
| 215 | +dotnet_diagnostic.AVP1002.severity = error |
| 216 | +dotnet_diagnostic.AVP1010.severity = error |
| 217 | +dotnet_diagnostic.AVP1011.severity = error |
| 218 | +dotnet_diagnostic.AVP1012.severity = warning |
| 219 | +dotnet_diagnostic.AVP1013.severity = error |
| 220 | +dotnet_diagnostic.AVP1020.severity = error |
| 221 | +dotnet_diagnostic.AVP1021.severity = error |
| 222 | +dotnet_diagnostic.AVP1022.severity = error |
| 223 | +dotnet_diagnostic.AVP1030.severity = error |
| 224 | +dotnet_diagnostic.AVP1031.severity = error |
| 225 | +dotnet_diagnostic.AVP1032.severity = error |
| 226 | +dotnet_diagnostic.AVP1040.severity = error |
| 227 | +dotnet_diagnostic.AVA2001.severity = error |
| 228 | +csharp_using_directive_placement = outside_namespace:silent |
| 229 | +csharp_prefer_simple_using_statement = true:suggestion |
| 230 | +csharp_prefer_braces = true:silent |
| 231 | +csharp_style_namespace_declarations = block_scoped:silent |
| 232 | +csharp_style_prefer_method_group_conversion = true:silent |
| 233 | +csharp_style_prefer_top_level_statements = true:silent |
| 234 | +csharp_style_prefer_primary_constructors = true:suggestion |
| 235 | +csharp_prefer_system_threading_lock = true:suggestion |
| 236 | +csharp_style_expression_bodied_lambdas = true:silent |
| 237 | +csharp_style_expression_bodied_local_functions = false:silent |
| 238 | + |
| 239 | +# Xaml files |
| 240 | +[*.{xaml,axaml}] |
| 241 | +indent_size = 2 |
| 242 | +# DuplicateSetterError |
| 243 | +avalonia_xaml_diagnostic.AVLN2203.severity = error |
| 244 | +# StyleInMergedDictionaries |
| 245 | +avalonia_xaml_diagnostic.AVLN2204.severity = error |
| 246 | +# RequiredTemplatePartMissing |
| 247 | +avalonia_xaml_diagnostic.AVLN2205.severity = error |
| 248 | +# OptionalTemplatePartMissing |
| 249 | +avalonia_xaml_diagnostic.AVLN2206.severity = info |
| 250 | +# TemplatePartWrongType |
| 251 | +avalonia_xaml_diagnostic.AVLN2207.severity = error |
| 252 | +# ItemContainerInsideTemplate |
| 253 | +avalonia_xaml_diagnostic.AVLN2208.severity = error |
| 254 | +# Obsolete |
| 255 | +avalonia_xaml_diagnostic.AVLN5001.severity = error |
| 256 | + |
| 257 | +# Xml project files |
| 258 | +[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] |
| 259 | +indent_size = 2 |
| 260 | + |
| 261 | +# Xml build files |
| 262 | +[*.builds] |
| 263 | +indent_size = 2 |
| 264 | + |
| 265 | +# Xml files |
| 266 | +[*.{xml,stylecop,resx,ruleset}] |
| 267 | +indent_size = 2 |
| 268 | + |
| 269 | +# Xml config files |
| 270 | +[*.{props,targets,config,nuspec}] |
| 271 | +indent_size = 2 |
| 272 | + |
| 273 | +[*.json] |
| 274 | +indent_size = 2 |
| 275 | + |
| 276 | +# Shell scripts |
| 277 | +[*.sh] |
| 278 | +end_of_line = lf |
| 279 | +[*.{cmd,bat}] |
| 280 | +end_of_line = crlf |
0 commit comments