|
| 1 | +root = true |
| 2 | + |
| 3 | +[*] |
| 4 | +indent_style = space |
| 5 | +charset = utf-8 |
| 6 | +trim_trailing_whitespace = true |
| 7 | +insert_final_newline = true |
| 8 | +spelling_exclusion_path = spelling.dic |
| 9 | + |
| 10 | +[*.cs] |
| 11 | +indent_size = 4 |
| 12 | +dotnet_sort_system_directives_first = true |
| 13 | + |
| 14 | +# Don't use this. qualifier |
| 15 | +dotnet_style_qualification_for_field = false:suggestion |
| 16 | +dotnet_style_qualification_for_property = false:suggestion |
| 17 | + |
| 18 | +# use int x = .. over Int32 |
| 19 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 20 | + |
| 21 | +# use int.MaxValue over Int32.MaxValue |
| 22 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 23 | + |
| 24 | +# Require var all the time. |
| 25 | +csharp_style_var_for_built_in_types = true:suggestion |
| 26 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 27 | +csharp_style_var_elsewhere = true:suggestion |
| 28 | + |
| 29 | +# Disallow throw expressions. |
| 30 | +csharp_style_throw_expression = false:suggestion |
| 31 | + |
| 32 | +# Newline settings |
| 33 | +csharp_new_line_before_open_brace = all |
| 34 | +csharp_new_line_before_else = true |
| 35 | +csharp_new_line_before_catch = true |
| 36 | +csharp_new_line_before_finally = true |
| 37 | +csharp_new_line_before_members_in_object_initializers = true |
| 38 | +csharp_new_line_before_members_in_anonymous_types = true |
| 39 | + |
| 40 | +# Namespace settings |
| 41 | +csharp_style_namespace_declarations = file_scoped |
| 42 | + |
| 43 | +# Brace settings |
| 44 | +csharp_prefer_braces = true # Prefer curly braces even for one line of code |
| 45 | + |
| 46 | +# name all constant fields using PascalCase |
| 47 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning |
| 48 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields |
| 49 | +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style |
| 50 | +dotnet_naming_symbols.constant_fields.applicable_kinds = field |
| 51 | +dotnet_naming_symbols.constant_fields.required_modifiers = const |
| 52 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 53 | + |
| 54 | +# static fields should have s_ prefix |
| 55 | +dotnet_naming_rule.static_fields_should_have_prefix.severity = warning |
| 56 | +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields |
| 57 | +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style |
| 58 | +dotnet_naming_symbols.static_fields.applicable_kinds = field |
| 59 | +dotnet_naming_symbols.static_fields.required_modifiers = static |
| 60 | +dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected |
| 61 | +dotnet_naming_style.static_prefix_style.required_prefix = s_ |
| 62 | +dotnet_naming_style.static_prefix_style.capitalization = camel_case |
| 63 | + |
| 64 | +# internal and private fields should be _camelCase |
| 65 | +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning |
| 66 | +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields |
| 67 | +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style |
| 68 | +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field |
| 69 | +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal |
| 70 | +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ |
| 71 | +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case |
| 72 | + |
| 73 | +[*.{xml,config,*proj,nuspec,props,resx,targets,yml,tasks}] |
| 74 | +indent_size = 2 |
| 75 | + |
| 76 | +# Xml config files |
| 77 | +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] |
| 78 | +indent_size = 2 |
| 79 | + |
| 80 | +[*.json] |
| 81 | +indent_size = 2 |
| 82 | + |
| 83 | +[*.{ps1,psm1}] |
| 84 | +indent_size = 4 |
| 85 | + |
| 86 | +[*.sh] |
| 87 | +indent_size = 4 |
| 88 | +end_of_line = lf |
| 89 | + |
| 90 | +[*.{razor,cshtml}] |
| 91 | +charset = utf-8-bom |
| 92 | + |
| 93 | +[*.{cs,vb}] |
| 94 | + |
| 95 | +# SYSLIB1054: Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time |
| 96 | +dotnet_diagnostic.SYSLIB1054.severity = warning |
| 97 | + |
| 98 | +# CA1018: Mark attributes with AttributeUsageAttribute |
| 99 | +dotnet_diagnostic.CA1018.severity = warning |
| 100 | + |
| 101 | +# CA1047: Do not declare protected member in sealed type |
| 102 | +dotnet_diagnostic.CA1047.severity = warning |
| 103 | + |
| 104 | +# CA1305: Specify IFormatProvider |
| 105 | +dotnet_diagnostic.CA1305.severity = warning |
| 106 | + |
| 107 | +# CA1507: Use nameof to express symbol names |
| 108 | +dotnet_diagnostic.CA1507.severity = warning |
| 109 | + |
| 110 | +# CA1510: Use ArgumentNullException throw helper |
| 111 | +dotnet_diagnostic.CA1510.severity = warning |
| 112 | + |
| 113 | +# CA1511: Use ArgumentException throw helper |
| 114 | +dotnet_diagnostic.CA1511.severity = warning |
| 115 | + |
| 116 | +# CA1512: Use ArgumentOutOfRangeException throw helper |
| 117 | +dotnet_diagnostic.CA1512.severity = warning |
| 118 | + |
| 119 | +# CA1513: Use ObjectDisposedException throw helper |
| 120 | +dotnet_diagnostic.CA1513.severity = warning |
| 121 | + |
| 122 | +# CA1725: Parameter names should match base declaration |
| 123 | +dotnet_diagnostic.CA1725.severity = suggestion |
| 124 | + |
| 125 | +# CA1802: Use literals where appropriate |
| 126 | +dotnet_diagnostic.CA1802.severity = warning |
| 127 | + |
| 128 | +# CA1805: Do not initialize unnecessarily |
| 129 | +dotnet_diagnostic.CA1805.severity = warning |
| 130 | + |
| 131 | +# CA1810: Do not initialize unnecessarily |
| 132 | +dotnet_diagnostic.CA1810.severity = warning |
| 133 | + |
| 134 | +# CA1821: Remove empty Finalizers |
| 135 | +dotnet_diagnostic.CA1821.severity = warning |
| 136 | + |
| 137 | +# CA1822: Make member static |
| 138 | +dotnet_diagnostic.CA1822.severity = warning |
| 139 | +dotnet_code_quality.CA1822.api_surface = private, internal |
| 140 | + |
| 141 | +# CA1823: Avoid unused private fields |
| 142 | +dotnet_diagnostic.CA1823.severity = warning |
| 143 | + |
| 144 | +# CA1825: Avoid zero-length array allocations |
| 145 | +dotnet_diagnostic.CA1825.severity = warning |
| 146 | + |
| 147 | +# CA1826: Do not use Enumerable methods on indexable collections. Instead use the collection directly |
| 148 | +dotnet_diagnostic.CA1826.severity = warning |
| 149 | + |
| 150 | +# CA1827: Do not use Count() or LongCount() when Any() can be used |
| 151 | +dotnet_diagnostic.CA1827.severity = warning |
| 152 | + |
| 153 | +# CA1828: Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used |
| 154 | +dotnet_diagnostic.CA1828.severity = warning |
| 155 | + |
| 156 | +# CA1829: Use Length/Count property instead of Count() when available |
| 157 | +dotnet_diagnostic.CA1829.severity = warning |
| 158 | + |
| 159 | +# CA1830: Prefer strongly-typed Append and Insert method overloads on StringBuilder |
| 160 | +dotnet_diagnostic.CA1830.severity = warning |
| 161 | + |
| 162 | +# CA1831: Use AsSpan or AsMemory instead of Range-based indexers when appropriate |
| 163 | +dotnet_diagnostic.CA1831.severity = warning |
| 164 | + |
| 165 | +# CA1832: Use AsSpan or AsMemory instead of Range-based indexers when appropriate |
| 166 | +dotnet_diagnostic.CA1832.severity = warning |
| 167 | + |
| 168 | +# CA1833: Use AsSpan or AsMemory instead of Range-based indexers when appropriate |
| 169 | +dotnet_diagnostic.CA1833.severity = warning |
| 170 | + |
| 171 | +# CA1834: Consider using 'StringBuilder.Append(char)' when applicable |
| 172 | +dotnet_diagnostic.CA1834.severity = warning |
| 173 | + |
| 174 | +# CA1835: Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync' |
| 175 | +dotnet_diagnostic.CA1835.severity = warning |
| 176 | + |
| 177 | +# CA1836: Prefer IsEmpty over Count |
| 178 | +dotnet_diagnostic.CA1836.severity = warning |
| 179 | + |
| 180 | +# CA1837: Use 'Environment.ProcessId' |
| 181 | +dotnet_diagnostic.CA1837.severity = warning |
| 182 | + |
| 183 | +# CA1838: Avoid 'StringBuilder' parameters for P/Invokes |
| 184 | +dotnet_diagnostic.CA1838.severity = warning |
| 185 | + |
| 186 | +# CA1839: Use 'Environment.ProcessPath' |
| 187 | +dotnet_diagnostic.CA1839.severity = warning |
| 188 | + |
| 189 | +# CA1840: Use 'Environment.CurrentManagedThreadId' |
| 190 | +dotnet_diagnostic.CA1840.severity = warning |
| 191 | + |
| 192 | +# CA1841: Prefer Dictionary.Contains methods |
| 193 | +dotnet_diagnostic.CA1841.severity = warning |
| 194 | + |
| 195 | +# CA1842: Do not use 'WhenAll' with a single task |
| 196 | +dotnet_diagnostic.CA1842.severity = warning |
| 197 | + |
| 198 | +# CA1843: Do not use 'WaitAll' with a single task |
| 199 | +dotnet_diagnostic.CA1843.severity = warning |
| 200 | + |
| 201 | +# CA1844: Provide memory-based overrides of async methods when subclassing 'Stream' |
| 202 | +dotnet_diagnostic.CA1844.severity = warning |
| 203 | + |
| 204 | +# CA1845: Use span-based 'string.Concat' |
| 205 | +dotnet_diagnostic.CA1845.severity = warning |
| 206 | + |
| 207 | +# CA1846: Prefer AsSpan over Substring |
| 208 | +dotnet_diagnostic.CA1846.severity = warning |
| 209 | + |
| 210 | +# CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters |
| 211 | +dotnet_diagnostic.CA1847.severity = warning |
| 212 | + |
| 213 | +# CA1852: Seal internal types |
| 214 | +dotnet_diagnostic.CA1852.severity = warning |
| 215 | + |
| 216 | +# CA1854: Prefer the IDictionary.TryGetValue(TKey, out TValue) method |
| 217 | +dotnet_diagnostic.CA1854.severity = warning |
| 218 | + |
| 219 | +# CA1855: Prefer 'Clear' over 'Fill' |
| 220 | +dotnet_diagnostic.CA1855.severity = warning |
| 221 | + |
| 222 | +# CA1856: Incorrect usage of ConstantExpected attribute |
| 223 | +dotnet_diagnostic.CA1856.severity = error |
| 224 | + |
| 225 | +# CA1857: A constant is expected for the parameter |
| 226 | +dotnet_diagnostic.CA1857.severity = warning |
| 227 | + |
| 228 | +# CA1858: Use 'StartsWith' instead of 'IndexOf' |
| 229 | +dotnet_diagnostic.CA1858.severity = warning |
| 230 | + |
| 231 | +# CA2007: Consider calling ConfigureAwait on the awaited task |
| 232 | +dotnet_diagnostic.CA2007.severity = none |
| 233 | + |
| 234 | +# CA2008: Do not create tasks without passing a TaskScheduler |
| 235 | +dotnet_diagnostic.CA2008.severity = warning |
| 236 | + |
| 237 | +# CA2009: Do not call ToImmutableCollection on an ImmutableCollection value |
| 238 | +dotnet_diagnostic.CA2009.severity = warning |
| 239 | + |
| 240 | +# CA2011: Avoid infinite recursion |
| 241 | +dotnet_diagnostic.CA2011.severity = warning |
| 242 | + |
| 243 | +# CA2012: Use ValueTask correctly |
| 244 | +dotnet_diagnostic.CA2012.severity = warning |
| 245 | + |
| 246 | +# CA2013: Do not use ReferenceEquals with value types |
| 247 | +dotnet_diagnostic.CA2013.severity = warning |
| 248 | + |
| 249 | +# CA2014: Do not use stackalloc in loops. |
| 250 | +dotnet_diagnostic.CA2014.severity = warning |
| 251 | + |
| 252 | +# CA2016: Forward the 'CancellationToken' parameter to methods that take one |
| 253 | +dotnet_diagnostic.CA2016.severity = warning |
| 254 | + |
| 255 | +# CA2200: Rethrow to preserve stack details |
| 256 | +dotnet_diagnostic.CA2200.severity = warning |
| 257 | + |
| 258 | +# CA2201: Do not raise reserved exception types |
| 259 | +dotnet_diagnostic.CA2201.severity = warning |
| 260 | + |
| 261 | +# CA2208: Instantiate argument exceptions correctly |
| 262 | +dotnet_diagnostic.CA2208.severity = warning |
| 263 | + |
| 264 | +# CA2245: Do not assign a property to itself |
| 265 | +dotnet_diagnostic.CA2245.severity = warning |
| 266 | + |
| 267 | +# CA2246: Assigning symbol and its member in the same statement |
| 268 | +dotnet_diagnostic.CA2246.severity = warning |
| 269 | + |
| 270 | +# CA2249: Use string.Contains instead of string.IndexOf to improve readability. |
| 271 | +dotnet_diagnostic.CA2249.severity = warning |
| 272 | + |
| 273 | +# IDE0005: Remove unnecessary usings |
| 274 | +dotnet_diagnostic.IDE0005.severity = warning |
| 275 | + |
| 276 | +# IDE0011: Curly braces to surround blocks of code |
| 277 | +dotnet_diagnostic.IDE0011.severity = warning |
| 278 | + |
| 279 | +# IDE0020: Use pattern matching to avoid is check followed by a cast (with variable) |
| 280 | +dotnet_diagnostic.IDE0020.severity = warning |
| 281 | + |
| 282 | +# IDE0029: Use coalesce expression (non-nullable types) |
| 283 | +dotnet_diagnostic.IDE0029.severity = warning |
| 284 | + |
| 285 | +# IDE0030: Use coalesce expression (nullable types) |
| 286 | +dotnet_diagnostic.IDE0030.severity = warning |
| 287 | + |
| 288 | +# IDE0031: Use null propagation |
| 289 | +dotnet_diagnostic.IDE0031.severity = warning |
| 290 | + |
| 291 | +# IDE0035: Remove unreachable code |
| 292 | +dotnet_diagnostic.IDE0035.severity = warning |
| 293 | + |
| 294 | +# IDE0036: Order modifiers |
| 295 | +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion |
| 296 | +dotnet_diagnostic.IDE0036.severity = warning |
| 297 | + |
| 298 | +# IDE0038: Use pattern matching to avoid is check followed by a cast (without variable) |
| 299 | +dotnet_diagnostic.IDE0038.severity = warning |
| 300 | + |
| 301 | +# IDE0043: Format string contains invalid placeholder |
| 302 | +dotnet_diagnostic.IDE0043.severity = warning |
| 303 | + |
| 304 | +# IDE0044: Make field readonly |
| 305 | +dotnet_diagnostic.IDE0044.severity = warning |
| 306 | + |
| 307 | +# IDE0051: Remove unused private members |
| 308 | +dotnet_diagnostic.IDE0051.severity = warning |
| 309 | + |
| 310 | +# IDE0055: All formatting rules |
| 311 | +dotnet_diagnostic.IDE0055.severity = suggestion |
| 312 | + |
| 313 | +# IDE0059: Unnecessary assignment to a value |
| 314 | +dotnet_diagnostic.IDE0059.severity = warning |
| 315 | + |
| 316 | +# IDE0060: Remove unused parameter |
| 317 | +dotnet_code_quality_unused_parameters = non_public |
| 318 | +dotnet_diagnostic.IDE0060.severity = warning |
| 319 | + |
| 320 | +# IDE0062: Make local function static |
| 321 | +dotnet_diagnostic.IDE0062.severity = warning |
| 322 | + |
| 323 | +# IDE1006: Required naming style |
| 324 | +dotnet_diagnostic.IDE1006.severity = warning |
| 325 | + |
| 326 | +# IDE0161: Convert to file-scoped namespace |
| 327 | +dotnet_diagnostic.IDE0161.severity = warning |
| 328 | + |
| 329 | +# IDE0200: Lambda expression can be removed |
| 330 | +dotnet_diagnostic.IDE0200.severity = warning |
| 331 | + |
| 332 | +# IDE2000: Disallow multiple blank lines |
| 333 | +dotnet_style_allow_multiple_blank_lines_experimental = false |
| 334 | +dotnet_diagnostic.IDE2000.severity = warning |
0 commit comments