|
| 1 | +; EditorConfig to support per-solution formatting. |
| 2 | +; Use the EditorConfig VS add-in to make this work. |
| 3 | +; http://editorconfig.org/ |
| 4 | + |
| 5 | +; This is the default for the codeline. |
| 6 | +root = true |
| 7 | + |
| 8 | +[*] |
| 9 | +; Don't use tabs for indentation. |
| 10 | +indent_style = space |
| 11 | +; (Please don't specify an indent_size here; that has too many unintended consequences.) |
| 12 | +charset = utf-8 |
| 13 | +trim_trailing_whitespace = true |
| 14 | +insert_final_newline = true |
| 15 | + |
| 16 | +# Spell checker configuration |
| 17 | +spelling_exclusion_path = spelling.dic |
| 18 | + |
| 19 | +; Code files |
| 20 | +[*.{cs}] |
| 21 | +indent_size = 4 |
| 22 | + |
| 23 | +; All XML-based file formats |
| 24 | +[*.{config,csproj,nuspec,props,resx,ruleset,targets,vsct,vsixmanifest,xaml,xml,vsmanproj,swixproj}] |
| 25 | +indent_size = 2 |
| 26 | + |
| 27 | +; JSON files |
| 28 | +[*.json] |
| 29 | +indent_size = 2 |
| 30 | + |
| 31 | +; PowerShell scripts |
| 32 | +[*.{ps1}] |
| 33 | +indent_size = 4 |
| 34 | + |
| 35 | +[*.{sh}] |
| 36 | +indent_size = 4 |
| 37 | + |
| 38 | +; Dotnet code style settings |
| 39 | +[*.{cs,vb}] |
| 40 | +; Sort using and Import directives with System.* appearing first |
| 41 | +dotnet_sort_system_directives_first = true |
| 42 | +dotnet_separate_import_directive_groups = false |
| 43 | + |
| 44 | +; IDE0003 Avoid "this." and "Me." if not necessary |
| 45 | +dotnet_style_qualification_for_field = false:warning |
| 46 | +dotnet_style_qualification_for_property = false:warning |
| 47 | +dotnet_style_qualification_for_method = false:warning |
| 48 | +dotnet_style_qualification_for_event = false:warning |
| 49 | + |
| 50 | +; IDE0012 Use language keywords instead of framework type names for type references |
| 51 | +dotnet_style_predefined_type_for_locals_parameters_members = true:warning |
| 52 | +; IDE0013 |
| 53 | +dotnet_style_predefined_type_for_member_access = true:warning |
| 54 | + |
| 55 | +; Suggest more modern language features when available |
| 56 | +dotnet_style_object_initializer = true:suggestion |
| 57 | +dotnet_style_collection_initializer = true:suggestion |
| 58 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 59 | +dotnet_style_coalesce_expression = true:suggestion |
| 60 | +dotnet_style_null_propagation = true:suggestion |
| 61 | + |
| 62 | +; Licence header |
| 63 | +file_header_template = Copyright (c) .NET Foundation. All rights reserved.\nLicensed under the Apache License, Version 2.0. See License.txt in the project root for license information. |
| 64 | + |
| 65 | +; CSharp code style settings |
| 66 | +[*.cs] |
| 67 | +; IDE0007 'var' preferences |
| 68 | +csharp_style_var_for_built_in_types = true:none |
| 69 | +csharp_style_var_when_type_is_apparent = true:none |
| 70 | +csharp_style_var_elsewhere = false:none |
| 71 | + |
| 72 | +; Prefer method-like constructs to have a block body |
| 73 | +csharp_style_expression_bodied_methods = false:none |
| 74 | +csharp_style_expression_bodied_constructors = false:none |
| 75 | +csharp_style_expression_bodied_operators = false:none |
| 76 | + |
| 77 | +; Prefer property-like constructs to have an expression-body |
| 78 | +csharp_style_expression_bodied_properties = true:suggestion |
| 79 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 80 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 81 | + |
| 82 | +; Suggest more modern language features when available |
| 83 | +csharp_style_pattern_matching_over_is_with_cast_check = true:none |
| 84 | +csharp_style_pattern_matching_over_as_with_null_check = true:none |
| 85 | +csharp_style_inlined_variable_declaration = true:none |
| 86 | +csharp_style_throw_expression = true:none |
| 87 | +csharp_style_conditional_delegate_call = true:suggestion |
| 88 | + |
| 89 | +; Newline settings |
| 90 | +csharp_new_line_before_open_brace = all |
| 91 | +csharp_new_line_before_else = true |
| 92 | +csharp_new_line_before_catch = true |
| 93 | +csharp_new_line_before_finally = true |
| 94 | +csharp_new_line_before_members_in_object_initializers = true |
| 95 | +csharp_new_line_before_members_in_anonymous_types = true |
| 96 | + |
| 97 | +; Naming styles |
| 98 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 99 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 100 | + |
| 101 | +; Naming rule: async methods end in Async |
| 102 | +dotnet_naming_style.async_method_style.capitalization = pascal_case |
| 103 | +dotnet_naming_style.async_method_style.required_suffix = Async |
| 104 | +dotnet_naming_symbols.async_method_symbols.applicable_kinds = method |
| 105 | +dotnet_naming_symbols.async_method_symbols.required_modifiers = async |
| 106 | +dotnet_naming_rule.async_methods_rule.severity = suggestion |
| 107 | +dotnet_naming_rule.async_methods_rule.symbols = async_method_symbols |
| 108 | +dotnet_naming_rule.async_methods_rule.style = async_method_style |
| 109 | + |
| 110 | +; Naming rule: Interfaces must be pascal-cased prefixed with I |
| 111 | +dotnet_naming_style.interface_style.capitalization = pascal_case |
| 112 | +dotnet_naming_style.interface_style.required_prefix = I |
| 113 | +dotnet_naming_symbols.interface_symbols.applicable_kinds = interface |
| 114 | +dotnet_naming_symbols.interface_symbols.applicable_accessibilities = * |
| 115 | +dotnet_naming_rule.interfaces_rule.severity = warning |
| 116 | +dotnet_naming_rule.interfaces_rule.symbols = interface_symbols |
| 117 | +dotnet_naming_rule.interfaces_rule.style = interface_style |
| 118 | + |
| 119 | +; Naming rule: All methods and properties must be pascal-cased |
| 120 | +dotnet_naming_symbols.method_and_property_symbols.applicable_kinds = method,property,class,struct,enum:property,namespace |
| 121 | +dotnet_naming_symbols.method_and_property_symbols.applicable_accessibilities = * |
| 122 | +dotnet_naming_rule.methods_and_properties_rule.severity = warning |
| 123 | +dotnet_naming_rule.methods_and_properties_rule.symbols = method_and_property_symbols |
| 124 | +dotnet_naming_rule.methods_and_properties_rule.style = pascal_case_style |
| 125 | + |
| 126 | +; Naming rule: Static fields must be pascal-cased |
| 127 | +dotnet_naming_symbols.static_member_symbols.applicable_kinds = field |
| 128 | +dotnet_naming_symbols.static_member_symbols.applicable_accessibilities = * |
| 129 | +dotnet_naming_symbols.static_member_symbols.required_modifiers = static |
| 130 | +dotnet_naming_symbols.const_member_symbols.applicable_kinds = field |
| 131 | +dotnet_naming_symbols.const_member_symbols.applicable_accessibilities = * |
| 132 | +dotnet_naming_symbols.const_member_symbols.required_modifiers = const |
| 133 | +dotnet_naming_rule.static_fields_rule.severity = warning |
| 134 | +dotnet_naming_rule.static_fields_rule.symbols = static_member_symbols |
| 135 | +dotnet_naming_rule.static_fields_rule.style = pascal_case_style |
| 136 | + |
| 137 | +; Naming rule: Private members must be camel-cased and prefixed with underscore |
| 138 | +dotnet_naming_style.private_member_style.capitalization = camel_case |
| 139 | +dotnet_naming_style.private_member_style.required_prefix = _ |
| 140 | +dotnet_naming_symbols.private_field_symbols.applicable_kinds = field |
| 141 | +dotnet_naming_symbols.private_field_symbols.applicable_accessibilities = private,protected,internal |
| 142 | +dotnet_naming_rule.private_field_rule.severity = warning |
| 143 | +dotnet_naming_rule.private_field_rule.symbols = private_field_symbols |
| 144 | +dotnet_naming_rule.private_field_rule.style = private_member_style |
| 145 | + |
| 146 | +; Diagnostics rule: Don't leave unnecessary suppressions |
| 147 | +dotnet_diagnostic.IDE0076.severity = warning |
| 148 | +dotnet_diagnostic.IDE0005.severity = warning |
| 149 | + |
| 150 | +; Diagnostics rule: Don't leave unused private methods |
| 151 | +dotnet_diagnostic.IDE0051.severity = warning |
| 152 | + |
| 153 | +# simplify linq expressions |
| 154 | +dotnet_diagnostic.IDE0120.severity = warning |
| 155 | + |
| 156 | +dotnet_diagnostic.VSTHRD200.severity = none |
| 157 | + |
| 158 | +# NuGet Code Analysis Rules |
| 159 | +# Code files under src/ folder |
| 160 | +[src/**/*.cs] |
| 161 | +dotnet_diagnostic.CA1000.severity = none |
| 162 | +dotnet_diagnostic.CA1001.severity = warning |
| 163 | +dotnet_diagnostic.CA1012.severity = warning |
| 164 | +dotnet_diagnostic.CA1016.severity = none |
| 165 | +dotnet_diagnostic.CA1018.severity = none |
| 166 | +dotnet_diagnostic.CA1028.severity = none |
| 167 | +dotnet_diagnostic.CA1030.severity = none |
| 168 | +dotnet_diagnostic.CA1031.severity = warning |
| 169 | +dotnet_diagnostic.CA1032.severity = none |
| 170 | +dotnet_diagnostic.CA1034.severity = none |
| 171 | +dotnet_diagnostic.CA1036.severity = none |
| 172 | +dotnet_diagnostic.CA1040.severity = none |
| 173 | +dotnet_diagnostic.CA1041.severity = none |
| 174 | +dotnet_diagnostic.CA1043.severity = none |
| 175 | +dotnet_diagnostic.CA1044.severity = none |
| 176 | +dotnet_diagnostic.CA1055.severity = none |
| 177 | +dotnet_diagnostic.CA1058.severity = none |
| 178 | +dotnet_diagnostic.CA1061.severity = none |
| 179 | +dotnet_code_quality.CA1062.null_check_validation_methods = Assumes |
| 180 | +dotnet_diagnostic.CA1064.severity = none |
| 181 | +dotnet_diagnostic.CA1065.severity = none |
| 182 | +dotnet_diagnostic.CA1066.severity = none |
| 183 | +dotnet_diagnostic.CA1068.severity = none |
| 184 | +dotnet_diagnostic.CA1200.severity = none |
| 185 | +dotnet_diagnostic.CA1303.severity = warning |
| 186 | +dotnet_diagnostic.CA1305.severity = warning |
| 187 | +dotnet_diagnostic.CA1401.severity = none |
| 188 | +dotnet_diagnostic.CA1501.severity = warning |
| 189 | +dotnet_diagnostic.CA1505.severity = warning |
| 190 | +dotnet_diagnostic.CA1707.severity = none |
| 191 | +dotnet_diagnostic.CA1710.severity = none |
| 192 | +dotnet_diagnostic.CA1712.severity = none |
| 193 | +dotnet_diagnostic.CA1714.severity = none |
| 194 | +dotnet_diagnostic.CA1715.severity = none |
| 195 | +dotnet_diagnostic.CA1716.severity = none |
| 196 | +dotnet_diagnostic.CA1717.severity = none |
| 197 | +dotnet_diagnostic.CA1720.severity = none |
| 198 | +dotnet_diagnostic.CA1721.severity = none |
| 199 | +dotnet_diagnostic.CA1724.severity = none |
| 200 | +dotnet_diagnostic.CA1801.severity = suggestion |
| 201 | +dotnet_diagnostic.CA1810.severity = none |
| 202 | +dotnet_diagnostic.CA1812.severity = none |
| 203 | +dotnet_diagnostic.CA1820.severity = none |
| 204 | +dotnet_diagnostic.CA1821.severity = warning |
| 205 | +dotnet_diagnostic.CA1822.severity = warning |
| 206 | +dotnet_diagnostic.CA1824.severity = none |
| 207 | +dotnet_diagnostic.CA1825.severity = warning |
| 208 | +dotnet_diagnostic.CA1826.severity = none |
| 209 | +dotnet_diagnostic.CA1828.severity = none |
| 210 | +dotnet_diagnostic.CA1829.severity = error |
| 211 | +dotnet_diagnostic.CA2002.severity = none |
| 212 | +dotnet_diagnostic.CA2007.severity = none |
| 213 | +dotnet_diagnostic.CA2008.severity = none |
| 214 | +dotnet_diagnostic.CA2009.severity = none |
| 215 | +dotnet_diagnostic.CA2010.severity = none |
| 216 | +dotnet_diagnostic.CA2016.severity = warning |
| 217 | +dotnet_diagnostic.CA2100.severity = none |
| 218 | +dotnet_diagnostic.CA2101.severity = none |
| 219 | +dotnet_diagnostic.CA2119.severity = none |
| 220 | +dotnet_diagnostic.CA2207.severity = none |
| 221 | +dotnet_diagnostic.CA2213.severity = warning |
| 222 | +dotnet_diagnostic.CA2214.severity = none |
| 223 | +dotnet_diagnostic.CA2216.severity = none |
| 224 | +dotnet_diagnostic.CA2219.severity = none |
| 225 | +dotnet_diagnostic.CA2226.severity = none |
| 226 | +dotnet_diagnostic.CA2229.severity = none |
| 227 | +dotnet_diagnostic.CA2231.severity = warning |
| 228 | +dotnet_diagnostic.CA2234.severity = none |
| 229 | +dotnet_diagnostic.CA2235.severity = none |
| 230 | +dotnet_diagnostic.CA2241.severity = none |
| 231 | +dotnet_diagnostic.CA2242.severity = none |
| 232 | +dotnet_diagnostic.CA2243.severity = none |
| 233 | +dotnet_diagnostic.CA2244.severity = none |
| 234 | +dotnet_diagnostic.CA2245.severity = none |
| 235 | +dotnet_diagnostic.CA2246.severity = none |
| 236 | +dotnet_diagnostic.CA2301.severity = warning |
| 237 | +dotnet_diagnostic.CA2302.severity = warning |
| 238 | +dotnet_diagnostic.CA2305.severity = warning |
| 239 | +dotnet_diagnostic.CA2311.severity = warning |
| 240 | +dotnet_diagnostic.CA2312.severity = warning |
| 241 | +dotnet_diagnostic.CA2315.severity = warning |
| 242 | +dotnet_diagnostic.CA2321.severity = warning |
| 243 | +dotnet_diagnostic.CA2322.severity = warning |
| 244 | +dotnet_diagnostic.CA3001.severity = warning |
| 245 | +dotnet_diagnostic.CA3061.severity = warning |
| 246 | +dotnet_diagnostic.CA3076.severity = warning |
| 247 | +dotnet_diagnostic.CA3077.severity = warning |
| 248 | +dotnet_diagnostic.CA3147.severity = warning |
| 249 | +dotnet_diagnostic.CA5351.severity = warning |
| 250 | +dotnet_diagnostic.CA5358.severity = warning |
| 251 | +dotnet_diagnostic.CA5359.severity = warning |
| 252 | +dotnet_diagnostic.CA5360.severity = none |
| 253 | +dotnet_diagnostic.CA5363.severity = none |
| 254 | +dotnet_diagnostic.CA5365.severity = none |
| 255 | +dotnet_diagnostic.CA5366.severity = none |
| 256 | +dotnet_diagnostic.CA5368.severity = none |
| 257 | +dotnet_diagnostic.CA5369.severity = none |
| 258 | +dotnet_diagnostic.CA5370.severity = none |
| 259 | +dotnet_diagnostic.CA5371.severity = none |
| 260 | +dotnet_diagnostic.CA5372.severity = none |
| 261 | +dotnet_diagnostic.CA5373.severity = none |
| 262 | +dotnet_diagnostic.CA5374.severity = none |
| 263 | +dotnet_diagnostic.CA5376.severity = none |
| 264 | +dotnet_diagnostic.CA5377.severity = none |
| 265 | +dotnet_diagnostic.CA5379.severity = none |
| 266 | +dotnet_diagnostic.CA5380.severity = none |
| 267 | +dotnet_diagnostic.CA5381.severity = none |
| 268 | +dotnet_diagnostic.CA5384.severity = none |
| 269 | +dotnet_diagnostic.CA5385.severity = none |
| 270 | +dotnet_diagnostic.CA5386.severity = warning |
| 271 | +dotnet_diagnostic.CA5397.severity = none |
| 272 | +dotnet_diagnostic.CA9999.severity = none |
| 273 | +dotnet_diagnostic.VSTHRD103.severity = silent |
| 274 | +dotnet_diagnostic.VSTHRD105.severity = silent |
| 275 | +dotnet_diagnostic.IDE0055.severity = warning |
| 276 | + |
| 277 | +# Code files under test/ folder |
| 278 | +[test/**/*.cs] |
| 279 | +dotnet_diagnostic.VSTHRD001.severity = none |
| 280 | +dotnet_diagnostic.VSTHRD002.severity = none |
| 281 | +dotnet_diagnostic.VSTHRD003.severity = none |
| 282 | +dotnet_diagnostic.VSTHRD010.severity = none |
| 283 | +dotnet_diagnostic.VSTHRD011.severity = none |
| 284 | +dotnet_diagnostic.VSTHRD012.severity = none |
| 285 | +dotnet_diagnostic.VSTHRD100.severity = none |
| 286 | +dotnet_diagnostic.VSTHRD101.severity = none |
| 287 | +dotnet_diagnostic.VSTHRD102.severity = none |
| 288 | +dotnet_diagnostic.VSTHRD103.severity = none |
| 289 | +dotnet_diagnostic.VSTHRD104.severity = none |
| 290 | +dotnet_diagnostic.VSTHRD105.severity = none |
| 291 | +dotnet_diagnostic.VSTHRD106.severity = none |
| 292 | +dotnet_diagnostic.IDE0055.severity = warning |
0 commit comments