@@ -5,23 +5,95 @@ root = true
5
5
[* ]
6
6
indent_style = tab
7
7
insert_final_newline = true
8
+ tab_width = 4
9
+ indent_size = 4
10
+ charset = utf-8
8
11
9
- # Build scripts
10
- [* .{yml,yaml} ]
11
- indent_style = spaces
12
- indent_size = 2
13
12
14
- # XML project files
15
- [* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct} ]
16
- indent_size = 2
13
+ # ## Naming rules: ###
17
14
18
- # Code files
19
- [* .cs ]
20
- indent_size = 4
21
- tab_width = 4
22
- charset = utf-8-bom
15
+ # Constants are PascalCase
16
+ dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
17
+ dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
18
+ dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
19
+
20
+ dotnet_naming_symbols.constants.applicable_kinds = field, local
21
+ dotnet_naming_symbols.constants.required_modifiers = const
22
+
23
+ dotnet_naming_style.constant_style.capitalization = pascal_case
24
+
25
+ # Non-private readonly fields are PascalCase
26
+ dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
27
+ dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
28
+ dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
29
+
30
+ dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
31
+ dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
32
+ dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
33
+
34
+ dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
35
+
36
+ # Non-private static fields are PascalCase
37
+ dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
38
+ dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
39
+ dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
40
+
41
+ dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
42
+ dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
43
+ dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
44
+
45
+ dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
23
46
24
- # # Dotnet code style settings:
47
+ # Static fields are s_camelCase
48
+ dotnet_naming_rule.static_fields_should_be_pascal_case.severity = suggestion
49
+ dotnet_naming_rule.static_fields_should_be_pascal_case.symbols = static_fields
50
+ dotnet_naming_rule.static_fields_should_be_pascal_case.style = static_field_style
51
+
52
+ dotnet_naming_symbols.static_fields.applicable_kinds = field
53
+ dotnet_naming_symbols.static_fields.required_modifiers = static
54
+
55
+ dotnet_naming_style.static_field_style.capitalization = camel_case
56
+ dotnet_naming_style.static_field_style.required_prefix = s_
57
+
58
+ # Instance fields are camelCase and start with _
59
+ dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
60
+ dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
61
+ dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
62
+
63
+ dotnet_naming_symbols.instance_fields.applicable_kinds = field
64
+
65
+ dotnet_naming_style.instance_field_style.capitalization = camel_case
66
+ dotnet_naming_style.instance_field_style.required_prefix = _
67
+
68
+ # Locals and parameters are camelCase
69
+ dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
70
+ dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
71
+ dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
72
+
73
+ dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
74
+
75
+ dotnet_naming_style.camel_case_style.capitalization = camel_case
76
+
77
+ # Local functions are PascalCase
78
+ dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
79
+ dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
80
+ dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
81
+
82
+ dotnet_naming_symbols.local_functions.applicable_kinds = local_function
83
+
84
+ dotnet_naming_style.local_function_style.capitalization = pascal_case
85
+
86
+ # By default, name items with PascalCase
87
+ dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
88
+ dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
89
+ dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
90
+
91
+ dotnet_naming_symbols.all_members.applicable_kinds = *
92
+
93
+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
94
+
95
+
96
+ # ## Dotnet code style settings: ###
25
97
26
98
# Sort using and Import directives with System.* appearing first
27
99
dotnet_sort_system_directives_first = true
@@ -40,14 +112,59 @@ dotnet_style_qualification_for_event = false:refactoring
40
112
dotnet_style_predefined_type_for_locals_parameters_members = true :error
41
113
dotnet_style_predefined_type_for_member_access = true :suggestion
42
114
43
- # Suggest more modern language features when available
115
+ # Initializers
44
116
dotnet_style_object_initializer = true :suggestion
45
117
dotnet_style_collection_initializer = true :suggestion
118
+ dotnet_style_prefer_collection_expression = when_types_loosely_match:warning
119
+
120
+ # Null checks
46
121
dotnet_style_coalesce_expression = true :suggestion
47
122
dotnet_style_null_propagation = true :suggestion
123
+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :warning
124
+
125
+ # Tuple Naming
48
126
dotnet_style_explicit_tuple_names = true :suggestion
127
+ dotnet_style_prefer_inferred_tuple_names = false :suggestion
128
+ dotnet_style_prefer_inferred_anonymous_type_member_names = false :suggestion
129
+
130
+ # Assignments
131
+ dotnet_style_prefer_conditional_expression_over_assignment = true :error
132
+ dotnet_style_prefer_conditional_expression_over_return = true :none
49
133
dotnet_style_prefer_compound_assignment = true :warning
50
134
135
+ # Parenthesis
136
+ dotnet_code_quality_unused_parameters = all:suggestion
137
+ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
138
+ dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
139
+ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
140
+ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
141
+
142
+ # Miscellaneous
143
+ dotnet_style_prefer_auto_properties = true :warning
144
+ dotnet_style_prefer_simplified_boolean_expressions = true :warning
145
+ dotnet_style_prefer_simplified_interpolation = true :warning
146
+ dotnet_style_namespace_match_folder = true :warning
147
+ dotnet_style_operator_placement_when_wrapping = beginning_of_line
148
+ dotnet_style_readonly_field = true :warning
149
+
150
+ # New-line preferences
151
+ dotnet_style_allow_multiple_blank_lines_experimental = false :warning
152
+ dotnet_style_allow_statement_immediately_after_block_experimental = false :warning
153
+ csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false :warning
154
+ csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false :warning
155
+
156
+ # Build scripts
157
+ [* .{yml,yaml} ]
158
+ indent_style = spaces
159
+ indent_size = 2
160
+
161
+ # XML project files
162
+ [* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct} ]
163
+ indent_size = 2
164
+
165
+ # Code files
166
+ [* .cs ]
167
+
51
168
# # C# style settings:
52
169
53
170
# Newline settings
@@ -85,16 +202,6 @@ csharp_style_expression_bodied_properties = true:suggestion
85
202
csharp_style_expression_bodied_indexers = true :suggestion
86
203
csharp_style_expression_bodied_accessors = true :suggestion
87
204
88
- # Suggest more modern language features when available
89
- csharp_style_pattern_matching_over_is_with_cast_check = true :warning
90
- csharp_style_pattern_matching_over_as_with_null_check = true :warning
91
- csharp_style_inlined_variable_declaration = true :warning
92
- csharp_style_throw_expression = true :warning
93
- csharp_style_conditional_delegate_call = true :warning
94
- csharp_style_prefer_switch_expression = true :warning
95
- csharp_prefer_simple_using_statement = true :suggestion
96
- csharp_style_namespace_declarations = file_scoped:error
97
-
98
205
# Space preferences
99
206
csharp_space_after_cast = false
100
207
csharp_space_after_colon_in_inheritance_clause = true
@@ -120,22 +227,98 @@ csharp_space_between_parentheses = false
120
227
csharp_space_between_square_brackets = false
121
228
122
229
# Blocks are allowed
123
- csharp_prefer_braces = when_multiline:suggestion
124
- csharp_preserve_single_line_blocks = true :suggestion
125
- csharp_preserve_single_line_statements = true :suggestion
230
+ csharp_prefer_braces = when_multiline:silent
231
+ csharp_preserve_single_line_blocks = true :silent
232
+ csharp_preserve_single_line_statements = true :silent
233
+
234
+ # Pattern Matching
235
+ csharp_style_prefer_pattern_matching = true :warning
236
+ csharp_style_prefer_not_pattern = true :warning
237
+ csharp_style_prefer_extended_property_pattern = true :warning
238
+ csharp_style_pattern_matching_over_as_with_null_check = true :warning
239
+ csharp_style_pattern_matching_over_is_with_cast_check = true :warning
240
+
241
+ # Namespace
242
+ csharp_style_namespace_declarations = file_scoped:error
243
+ csharp_using_directive_placement = outside_namespace:warning
244
+
245
+ # Suggest more modern language features when available
246
+ csharp_prefer_simple_default_expression = true :warning
247
+ csharp_prefer_simple_using_statement = true :suggestion
248
+ csharp_prefer_static_local_function = true :suggestion
249
+ csharp_style_conditional_delegate_call = true :warning
250
+ csharp_style_deconstructed_variable_declaration = true :warning
251
+ csharp_style_expression_bodied_lambdas = true :suggestion
252
+ csharp_style_implicit_object_creation_when_type_is_apparent = true :suggestion
253
+ csharp_style_inlined_variable_declaration = true :warning
254
+ csharp_style_prefer_index_operator = true :suggestion
255
+ csharp_style_prefer_local_over_anonymous_function = true :suggestion
256
+ csharp_style_prefer_method_group_conversion = true :silent
257
+ csharp_style_prefer_null_check_over_type_check = true :suggestion
258
+ csharp_style_prefer_primary_constructors = true :warning
259
+ csharp_style_prefer_range_operator = true :suggestion
260
+ csharp_style_prefer_readonly_struct = true :suggestion
261
+ csharp_style_prefer_readonly_struct_member = true :suggestion
262
+ csharp_style_prefer_switch_expression = true :warning
263
+ csharp_style_prefer_top_level_statements = true :silent
264
+ csharp_style_prefer_tuple_swap = true :suggestion
265
+ csharp_style_prefer_utf8_string_literals = true :suggestion
266
+ csharp_style_throw_expression = true :warning
267
+ csharp_style_unused_value_assignment_preference = discard_variable:warning
268
+ csharp_style_unused_value_expression_statement_preference = discard_variable:none
269
+
270
+ # New Lines
271
+ csharp_style_allow_embedded_statements_on_same_line_experimental = true :silent
272
+ csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true :silent
273
+ csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true :silent
274
+ csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true :silent
275
+ csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true :silent
276
+
277
+ # Resharper
278
+ resharper_align_multiline_binary_expressions_chain = false
279
+ resharper_align_multiline_comments = false
280
+ resharper_align_multiline_statement_conditions = false
281
+ resharper_csharp_alignment_tab_fill_style = use_tabs_only
282
+ resharper_csharp_max_line_length = 150
283
+ resharper_indent_raw_literal_string = do_not_change
284
+ resharper_trailing_comma_in_multiline_lists = true
126
285
127
286
# Style Analytics
128
- dotnet_analyzer_diagnostic.category-Style.severity = warning
129
-
130
- # Specific issues to ignore
131
- dotnet_diagnostic.CA1001.severity = none # CA1001: Types that own disposable fields should be disposable
132
- dotnet_diagnostic.CA1304.severity = none # CA1304: Specify CultureInfo
133
- dotnet_diagnostic.CA1305.severity = none # CA1305: Specify IFormatProvider
134
- dotnet_diagnostic.CA1309.severity = none # CA1309: Use ordinal string comparison
135
- dotnet_diagnostic.CA1310.severity = none # CA1310: Specify StringComparison for correctness
136
- dotnet_diagnostic.CA1311.severity = none # CA1311: Specify a culture or use an invariant version
137
- dotnet_diagnostic.CA1707.severity = none # CA1707: Identifiers should not contain underscores
138
- dotnet_diagnostic.CA1819.severity = none # CA1819: Properties should not return arrays
139
- dotnet_diagnostic.CA5394.severity = none # CA5394: Random is an insecure random number generator. Use cryptographically secure random number generators when randomness is required for security.
140
-
141
- dotnet_diagnostic.IDE0290.severity = none # IDE0290: Use primary constructor
287
+ dotnet_analyzer_diagnostic.category-Style.severity = suggestion
288
+
289
+ # XML Documentation
290
+ dotnet_diagnostic.CS0105.severity = error # CS0105: Using directive is unnecessary.
291
+ dotnet_diagnostic.CS1573.severity = none # CS1573: Missing XML comment for parameter
292
+ dotnet_diagnostic.CS1591.severity = none # CS1591: Missing XML comment for publicly visible type or member
293
+ dotnet_diagnostic.CS1712.severity = none # CS1712: Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)
294
+
295
+ dotnet_diagnostic.CA1001.severity = none # CA1001: Types that own disposable fields should be disposable
296
+ dotnet_diagnostic.CA1034.severity = none # CA1034: Nested types should not be visible
297
+ dotnet_diagnostic.CA1062.severity = none # CA1062: Validate arguments of public methods
298
+ dotnet_diagnostic.CA1304.severity = none # CA1304: Specify CultureInfo
299
+ dotnet_diagnostic.CA1305.severity = none # CA1305: Specify IFormatProvider
300
+ dotnet_diagnostic.CA1307.severity = none # CA1307: Specify StringComparison for clarity
301
+ dotnet_diagnostic.CA1310.severity = none # CA1310: Specify StringComparison for correctness
302
+ dotnet_diagnostic.CA1311.severity = none # CA1311: Specify a culture or use an invariant version
303
+ dotnet_diagnostic.CA1515.severity = none # CA1515: Consider making public types internal
304
+ dotnet_diagnostic.CA1707.severity = none # CA1707: Identifiers should not contain underscores
305
+ dotnet_diagnostic.CA1708.severity = none # CA1708: Identifiers should differ by more than case
306
+ dotnet_diagnostic.CA1716.severity = none # CA1716: Identifiers should not match keywords
307
+ dotnet_diagnostic.CA1814.severity = none # CA1814: Prefer jagged arrays over multidimensional
308
+ dotnet_diagnostic.CA1819.severity = none # CA1819: Properties should not return arrays
309
+ dotnet_diagnostic.CA2000.severity = none # CA2000: Dispose objects before losing scope
310
+ dotnet_diagnostic.CA2234.severity = none # CA2234: Pass system uri objects instead of strings
311
+ dotnet_diagnostic.CA5399.severity = none # CA5399: HttpClient is created without enabling CheckCertificateRevocationList
312
+ dotnet_diagnostic.IDE0058.severity = none # IDE0058: Expression value is never used
313
+ dotnet_diagnostic.IDE0059.severity = none # IDE0059: Unnecessary assignment of a value
314
+ dotnet_diagnostic.IDE0120.severity = none # IDE0120: Simplify LINQ expression
315
+ dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
316
+
317
+ [** /* .ProgramArguments.cs ]
318
+ # Mark code as excluded and generated
319
+ # NB: This disables regular analyzers by default
320
+ exclude = true
321
+ generated_code = true
322
+
323
+ # Disable any active Roslyn analyzers
324
+ dotnet_analyzer_diagnostic.severity = none
0 commit comments