@@ -7,113 +7,163 @@ root = true
7
7
# XML project files
8
8
[* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj} ]
9
9
indent_size = 2
10
+ insert_final_newline = true
11
+ trim_trailing_whitespace = true
10
12
11
13
# XML config files
12
14
[* .{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct} ]
13
15
indent_size = 2
16
+ insert_final_newline = true
17
+ trim_trailing_whitespace = true
14
18
15
19
# Code files
16
20
[* .{cs,csx,vb,vbx} ]
17
21
indent_size = 4
18
22
insert_final_newline = true
23
+ trim_trailing_whitespace = true
19
24
charset = utf-8-bom
20
25
21
26
# ##############################
22
27
# .NET Coding Conventions #
23
28
# ##############################
29
+
24
30
[* .{cs,vb} ]
25
31
# Organize usings
26
- dotnet_sort_system_directives_first = true
32
+ dotnet_sort_system_directives_first = true :error
33
+ dotnet_separate_import_directive_groups = true :error
34
+
27
35
# this. preferences
28
- dotnet_style_qualification_for_field = false :silent
29
- dotnet_style_qualification_for_property = false :silent
30
- dotnet_style_qualification_for_method = false :silent
31
- dotnet_style_qualification_for_event = false :silent
36
+ dotnet_style_qualification_for_field = true :error
37
+ dotnet_style_qualification_for_property = true :error
38
+ dotnet_style_qualification_for_method = true :error
39
+ dotnet_style_qualification_for_event = true :error
40
+
32
41
# Language keywords vs BCL types preferences
33
- dotnet_style_predefined_type_for_locals_parameters_members = true :silent
34
- dotnet_style_predefined_type_for_member_access = true :silent
42
+ dotnet_style_predefined_type_for_locals_parameters_members = true :error
43
+ dotnet_style_predefined_type_for_member_access = true :error
44
+
35
45
# Parentheses preferences
36
- dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
37
- dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
38
- dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
39
- dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
46
+ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:error
47
+ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:error
48
+ dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:error
49
+ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:error
50
+
40
51
# Modifier preferences
41
- dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
42
- dotnet_style_readonly_field = true :suggestion
52
+ dotnet_style_require_accessibility_modifiers = always:error
53
+ dotnet_style_readonly_field = true :error
54
+
43
55
# Expression-level preferences
44
- dotnet_style_object_initializer = true :suggestion
45
- dotnet_style_collection_initializer = true :suggestion
46
- dotnet_style_explicit_tuple_names = true :suggestion
47
- dotnet_style_null_propagation = true :suggestion
48
- dotnet_style_coalesce_expression = true :suggestion
49
- dotnet_style_prefer_is_null_check_over_reference_equality_method = true :silent
50
- dotnet_style_prefer_inferred_tuple_names = true :suggestion
51
- dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
52
- dotnet_style_prefer_auto_properties = true :silent
53
- dotnet_style_prefer_conditional_expression_over_assignment = true :silent
54
- dotnet_style_prefer_conditional_expression_over_return = true :silent
56
+ dotnet_style_object_initializer = true :error
57
+ dotnet_style_collection_initializer = true :error
58
+ dotnet_style_explicit_tuple_names = true :error
59
+ dotnet_style_null_propagation = true :error
60
+ dotnet_style_coalesce_expression = true :error
61
+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :error
62
+ dotnet_style_prefer_inferred_tuple_names = true :error
63
+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :error
64
+ dotnet_style_prefer_auto_properties = true :error
65
+ dotnet_style_prefer_conditional_expression_over_assignment = true :error
66
+ dotnet_style_prefer_conditional_expression_over_return = true :error
67
+
68
+ # Namespace preferences
69
+ csharp_style_namespace_declarations = file_scoped:error
55
70
56
71
# ##############################
57
72
# Naming Conventions #
58
73
# ##############################
74
+
59
75
# Style Definitions
60
- dotnet_naming_style.pascal_case_style.capitalization = pascal_case
61
- # Use PascalCase for constant fields
62
- dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
63
- dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
64
- dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
65
- dotnet_naming_symbols.constant_fields.applicable_kinds = field
66
- dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
67
- dotnet_naming_symbols.constant_fields.required_modifiers = const
76
+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
77
+ dotnet_style_allow_multiple_blank_lines_experimental = false
78
+
79
+ # Use PascalCase for constant fields
80
+ dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = error
81
+ dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
82
+ dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
83
+ dotnet_naming_symbols.constant_fields.applicable_kinds = field
84
+ dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
85
+ dotnet_naming_symbols.constant_fields.required_modifiers = const
86
+
87
+ # Use PascalCase for public members (properties, methods, events)
88
+ dotnet_naming_rule.public_members_should_be_pascal_case.severity = error
89
+ dotnet_naming_rule.public_members_should_be_pascal_case.symbols = public_members
90
+ dotnet_naming_rule.public_members_should_be_pascal_case.style = pascal_case_style
91
+ dotnet_naming_symbols.public_members.applicable_kinds = property,method,event,field
92
+ dotnet_naming_symbols.public_members.applicable_accessibilities = public,protected,internal,protected_internal
93
+
94
+ # Use camelCase with '_' prefix for private fields
95
+ dotnet_naming_style.underscore_prefix_style.capitalization = camel_case
96
+ dotnet_naming_style.underscore_prefix_style.required_prefix = _
97
+ dotnet_naming_rule.private_fields_should_have_underscore_prefix.severity = error
98
+ dotnet_naming_rule.private_fields_should_have_underscore_prefix.symbols = private_fields
99
+ dotnet_naming_rule.private_fields_should_have_underscore_prefix.style = underscore_prefix_style
100
+ dotnet_naming_symbols.private_fields.applicable_kinds = field
101
+ dotnet_naming_symbols.private_fields.applicable_accessibilities = private
68
102
69
103
# ##############################
70
104
# Analyzers #
71
105
# ##############################
72
- dotnet_analyzer_diagnostic.category-CodeQuality.severity = suggestion
73
- dotnet_analyzer_diagnostic.category-Documentation.severity = suggestion
74
- dotnet_analyzer_diagnostic.category-Design.severity = suggestion
75
- dotnet_analyzer_diagnostic.category-Performance.severity = suggestion
76
- dotnet_analyzer_diagnostic.category-Reliability.severity = warning
77
- dotnet_analyzer_diagnostic.category-Security.severity = warning
78
- dotnet_analyzer_diagnostic.category-Style.severity = suggestion
106
+
107
+ dotnet_analyzer_diagnostic.category-CodeQuality.severity = error
108
+ dotnet_analyzer_diagnostic.category-Documentation.severity = error
109
+ dotnet_analyzer_diagnostic.category-Design.severity = error
110
+ dotnet_analyzer_diagnostic.category-Performance.severity = error
111
+ dotnet_analyzer_diagnostic.category-Reliability.severity = error
112
+ dotnet_analyzer_diagnostic.category-Security.severity = error
113
+ dotnet_analyzer_diagnostic.category-Style.severity = error
79
114
80
115
# Explicit code exclusions
81
- dotnet_diagnostic.IDE0160.severity = none
82
- dotnet_diagnostic.CA1848.severity = none
116
+ # Namespace does not match folder structure
117
+ dotnet_diagnostic.IDE0130.severity = none
118
+ # Collection initialization can be simplified
119
+ dotnet_diagnostic.IDE0301.severity = none
120
+ dotnet_diagnostic.IDE0300.severity = none
121
+ dotnet_diagnostic.IDE0305.severity = none
122
+ # If statement can be simplified
123
+ dotnet_diagnostic.IDE0046.severity = none
124
+ dotnet_diagnostic.IDE0045.severity = none
125
+ # Use switch expression
126
+ dotnet_diagnostic.IDE0066.severity = none
83
127
84
128
# ##############################
85
129
# C# Coding Conventions #
86
130
# ##############################
87
131
[* .cs ]
88
132
# var preferences
89
- csharp_style_var_for_built_in_types = true :silent
90
- csharp_style_var_when_type_is_apparent = true :silent
91
- csharp_style_var_elsewhere = true :silent
133
+ csharp_style_var_for_built_in_types = true :error
134
+ csharp_style_var_when_type_is_apparent = true :error
135
+ csharp_style_var_elsewhere = true :error
136
+
92
137
# Expression-bodied members
93
- csharp_style_expression_bodied_methods = false :silent
94
- csharp_style_expression_bodied_constructors = false :silent
95
- csharp_style_expression_bodied_operators = false :silent
96
- csharp_style_expression_bodied_properties = true :silent
97
- csharp_style_expression_bodied_indexers = true :silent
98
- csharp_style_expression_bodied_accessors = true :silent
138
+ csharp_style_expression_bodied_methods = when_possible:error
139
+ csharp_style_expression_bodied_constructors = when_possible:error
140
+ csharp_style_expression_bodied_operators = when_possible:error
141
+ csharp_style_expression_bodied_properties = when_possible:error
142
+ csharp_style_expression_bodied_indexers = when_possible:error
143
+ csharp_style_expression_bodied_accessors = when_possible:error
144
+
99
145
# Pattern matching preferences
100
- csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
101
- csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
146
+ csharp_style_pattern_matching_over_is_with_cast_check = true :error
147
+ csharp_style_pattern_matching_over_as_with_null_check = true :error
148
+
102
149
# Null-checking preferences
103
- csharp_style_throw_expression = true :suggestion
104
- csharp_style_conditional_delegate_call = true :suggestion
150
+ csharp_style_throw_expression = true :error
151
+ csharp_style_conditional_delegate_call = true :error
152
+
105
153
# Modifier preferences
106
- csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
154
+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error
155
+
107
156
# Expression-level preferences
108
- csharp_prefer_braces = true :silent
109
- csharp_style_deconstructed_variable_declaration = true :suggestion
110
- csharp_prefer_simple_default_expression = true :suggestion
111
- csharp_style_pattern_local_over_anonymous_function = true :suggestion
112
- csharp_style_inlined_variable_declaration = true :suggestion
157
+ csharp_prefer_braces = true :error
158
+ csharp_style_deconstructed_variable_declaration = true :error
159
+ csharp_prefer_simple_default_expression = true :error
160
+ csharp_style_pattern_local_over_anonymous_function = true :error
161
+ csharp_style_inlined_variable_declaration = true :error
113
162
114
163
# ##############################
115
164
# C# Formatting Rules #
116
165
# ##############################
166
+
117
167
# New line preferences
118
168
csharp_new_line_before_open_brace = all
119
169
csharp_new_line_before_else = true
@@ -122,10 +172,12 @@ csharp_new_line_before_finally = true
122
172
csharp_new_line_before_members_in_object_initializers = true
123
173
csharp_new_line_before_members_in_anonymous_types = true
124
174
csharp_new_line_between_query_expression_clauses = true
175
+
125
176
# Indentation preferences
126
177
csharp_indent_case_contents = true
127
178
csharp_indent_switch_labels = true
128
179
csharp_indent_labels = flush_left
180
+
129
181
# Space preferences
130
182
csharp_space_after_cast = false
131
183
csharp_space_after_keywords_in_control_flow_statements = true
@@ -138,6 +190,7 @@ csharp_space_around_binary_operators = before_and_after
138
190
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
139
191
csharp_space_between_method_call_name_and_opening_parenthesis = false
140
192
csharp_space_between_method_call_empty_parameter_list_parentheses = false
193
+
141
194
# Wrapping preferences
142
195
csharp_preserve_single_line_statements = true
143
196
csharp_preserve_single_line_blocks = true
0 commit comments