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