-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.editorconfig
More file actions
318 lines (270 loc) · 14.2 KB
/
.editorconfig
File metadata and controls
318 lines (270 loc) · 14.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# Suppress: EC112
# top-most EditorConfig file
root = true
# =============================================
# GLOBAL SETTINGS
# =============================================
[*]
insert_final_newline = true
indent_style = tab
indent_size = 4
# =============================================
# FILE TYPE SPECIFIC SETTINGS
# =============================================
# Project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 4
# MSBuild and configuration files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
# Data format files
[*.{json,xml}]
indent_size = 2
# =============================================
# .NET COMMON SETTINGS (C#, VB)
# =============================================
[*.{cs,csx,vb,vbx}]
# Basic formatting
end_of_line = crlf
dotnet_style_operator_placement_where_wrapping = beginning_of_line
# .NET Code style - Language constructs
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_return = true:none
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
# .NET Code style - Collections and initialization
dotnet_style_collection_initializer = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_prefer_collection_expression = true:suggestion
# .NET Code style - Tuples and anonymous types
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
# .NET Code style - Accessibility and organization
dotnet_style_require_accessibility_modifiers = omit_if_default:error
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
# =============================================
# C# SPECIFIC SETTINGS
# =============================================
[*.cs]
# ---------------------------------------------
# Using and namespace organization
# ---------------------------------------------
dotnet_sort_system_directives_first = true
csharp_using_directive_placement = outside_namespace:silent
dotnet_style_prefer_global_using_directives = true:suggestion
csharp_style_namespace_declarations = file_scoped:error
# ---------------------------------------------
# Code style preferences
# ---------------------------------------------
csharp_prefer_braces = true:silent
csharp_prefer_static_local_function = true:suggestion
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_prefer_system_threading_lock = true:suggestion
# ---------------------------------------------
# Expression preferences
# ---------------------------------------------
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_prefer_simple_property_accessors = true:suggestion
# ---------------------------------------------
# Pattern matching preferences
# ---------------------------------------------
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
# ---------------------------------------------
# Variable preferences
# ---------------------------------------------
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = false:suggestion
csharp_style_var_elsewhere = false:suggestion
# ---------------------------------------------
# Expression-bodied members
# ---------------------------------------------
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = true:silent
# ---------------------------------------------
# Modern C# features
# ---------------------------------------------
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_prefer_raw_string_literals = true:suggestion
csharp_style_prefer_primary_constructors = false:suggestion # For classes/structs
csharp_style_prefer_primary_constructors_on_records = true:suggestion # For records
csharp_style_prefer_required_properties = true:suggestion
# ---------------------------------------------
# Modifier preferences
# ---------------------------------------------
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error
# =============================================
# C# FORMATTING RULES
# =============================================
# ---------------------------------------------
# Spacing preferences
# ---------------------------------------------
csharp_space_around_binary_operators = before_and_after
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
# ---------------------------------------------
# New line preferences
# ---------------------------------------------
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
# ---------------------------------------------
# Indentation preferences
# ---------------------------------------------
csharp_indent_labels = one_less_than_current
# ---------------------------------------------
# Miscellaneous preferences
# ---------------------------------------------
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
# =============================================
# NAMING CONVENTIONS
# =============================================
# Enable naming rule violations
dotnet_diagnostic.IDE1006.severity = error
# Define naming styles
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_style.camel_case_style.capitalization = camel_case
dotnet_naming_style.underscore_prefix_camel_case_style.capitalization = camel_case
dotnet_naming_style.underscore_prefix_camel_case_style.required_prefix = _
# ---------------------------------------------
# Field naming rules
# ---------------------------------------------
# Public fields: PascalCase
dotnet_naming_symbols.public_fields.applicable_kinds = field
dotnet_naming_symbols.public_fields.applicable_accessibilities = public
dotnet_naming_rule.public_fields_should_be_pascal_case.symbols = public_fields
dotnet_naming_rule.public_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_rule.public_fields_should_be_pascal_case.severity = suggestion
# Private fields: _camelCase
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_rule.private_fields_should_have_underscore_prefix.symbols = private_fields
dotnet_naming_rule.private_fields_should_have_underscore_prefix.style = underscore_prefix_camel_case_style
dotnet_naming_rule.private_fields_should_have_underscore_prefix.severity = suggestion
# Instance fields: camelCase (protected, internal, etc.)
dotnet_naming_symbols.instance_fields.applicable_kinds = field
dotnet_naming_symbols.instance_fields.applicable_accessibilities = internal, protected, protected_internal, private_protected
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
dotnet_naming_rule.instance_fields_should_be_camel_case.style = camel_case_style
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = error
# Static fields: camelCase (non-public)
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_symbols.static_fields.applicable_accessibilities = internal, private, protected, protected_internal, private_protected
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_style
dotnet_naming_rule.static_fields_should_be_camel_case.severity = error
# =============================================
# DIAGNOSTIC RULES
# =============================================
# ---------------------------------------------
# IDE Rules
# ---------------------------------------------
dotnet_diagnostic.IDE0011.severity = error # Use braces
dotnet_diagnostic.IDE0046.severity = none # Convert to conditional expression (disabled)
dotnet_diagnostic.IDE0220.severity = error # Add parentheses for clarity
dotnet_diagnostic.IDE1006.severity = error # Naming rule violations
# ---------------------------------------------
# Compiler Warnings
# ---------------------------------------------
dotnet_diagnostic.CS1591.severity = suggestion # Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS4014.severity = error # Unawaited tasks
# ---------------------------------------------
# Code Analysis - Security
# ---------------------------------------------
dotnet_diagnostic.CA2007.severity = silent # ConfigureAwait
dotnet_diagnostic.CA2009.severity = error # Do not call ToImmutableCollection on an ImmutableCollection value
dotnet_diagnostic.CA2011.severity = error # Avoid infinite recursion
dotnet_diagnostic.CA2012.severity = error # Use ValueTasks correctly
dotnet_diagnostic.CA2017.severity = error # Parameter count mismatch
dotnet_diagnostic.CA2018.severity = error # Buffer size mismatch
dotnet_diagnostic.CA2100.severity = error # SQL injection
dotnet_diagnostic.CA3001.severity = error # XSS vulnerabilities
dotnet_diagnostic.CA5350.severity = error # Do Not Use Weak Cryptographic Algorithms
dotnet_diagnostic.CA5351.severity = error # Do Not Use Broken Cryptographic Algorithms
# ---------------------------------------------
# Code Analysis - Performance
# ---------------------------------------------
dotnet_diagnostic.CA1805.severity = warning # Unnecessary initialization
dotnet_diagnostic.CA1810.severity = warning # Static constructor performance
dotnet_diagnostic.CA1822.severity = error # Mark members as static
dotnet_diagnostic.CA1834.severity = error # Use StringBuilder.Append(char)
# ---------------------------------------------
# Code Analysis - Design
# ---------------------------------------------
dotnet_diagnostic.CA1050.severity = error # Declare types in namespaces
dotnet_diagnostic.CA1063.severity = error # IDisposable implementation
dotnet_diagnostic.CA2016.severity = error # Forward CancellationToken
dotnet_diagnostic.CA2208.severity = error # Instantiate argument exceptions correctly
# ---------------------------------------------
# Code Analysis - Resource Management
# ---------------------------------------------
dotnet_diagnostic.CA2000.severity = warning # Dispose objects before losing scope
dotnet_diagnostic.CA2213.severity = error # Disposable fields should be disposed
# ---------------------------------------------
# Code Analysis - Exception Handling
# ---------------------------------------------
dotnet_diagnostic.CA1031.severity = warning # Do not catch general exception types
dotnet_diagnostic.CA2201.severity = error # Do not raise reserved exception types
# ---------------------------------------------
# Code Analysis - Disabled/Silent Rules
# ---------------------------------------------
dotnet_diagnostic.CA1711.severity = none # Identifiers should not have incorrect suffix
dotnet_diagnostic.CA1826.severity = silent # Use property instead of Linq Enumerable method
# ---------------------------------------------
# Third-party Analyzer Rules - Roslynator
# ---------------------------------------------
dotnet_diagnostic.RCS1075.severity = none # Avoid empty catch clause that catches System.Exception
dotnet_diagnostic.RCS1146.severity = none # Use conditional access
dotnet_diagnostic.RCS1161.severity = none # Enum should declare explicit values
# ---------------------------------------------
# Third-party Analyzer Rules - SonarAnalyzer
# ---------------------------------------------
dotnet_diagnostic.S112.severity = silent # General exceptions should never be thrown
dotnet_diagnostic.S1135.severity = suggestion # Track uses of "TODO" tags
dotnet_diagnostic.S1643.severity = silent # Strings should not be concatenated using '+' in a loop
dotnet_diagnostic.S2344.severity = none # Enumeration type names should not have "Flags" or "Enum" suffixes
dotnet_diagnostic.S3358.severity = silent # Ternary operators should not be nested
dotnet_diagnostic.S1121.severity = none # Assignments should not be made from within sub-expressions
# Verify
[*.{received,verified}.{cs,txt}]
charset = utf-8-bom
end_of_line = lf
indent_size = unset
indent_style = unset
insert_final_newline = false
tab_width = unset
trim_trailing_whitespace = false