-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.editorconfig
More file actions
286 lines (252 loc) · 15 KB
/
Copy path.editorconfig
File metadata and controls
286 lines (252 loc) · 15 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
# EditorConfig — https://editorconfig.org
root = true
# ─── Defaults ───────────────────────────────────────────────────
[*]
charset = utf-8
end_of_line = crlf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
guidelines = 80
[*.md]
trim_trailing_whitespace = false
max_line_length = off
[*.{yml,yaml}]
indent_size = 2
[*.json]
indent_size = 2
[*.{csproj,props,targets,slnx}]
indent_size = 2
# ─── C# ────────────────────────────────────────────────────────
[*.cs]
# ── Usings ──────────────────────────────────────────────────────
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
csharp_using_directive_placement = outside_namespace:warning
# ── Namespaces ──────────────────────────────────────────────────
csharp_style_namespace_declarations = file_scoped:warning
# ── var ─────────────────────────────────────────────────────────
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
# ── Expression-bodied members ───────────────────────────────────
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
# ── Pattern matching (modern C# 14 style) ──────────────────────
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
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
# ── Null / simplification ──────────────────────────────────────
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
# ── Modern C# preferences ──────────────────────────────────────
csharp_style_prefer_top_level_statements = true:suggestion
csharp_style_prefer_primary_constructors = 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_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_static_local_function = true:suggestion
csharp_style_prefer_method_group_conversion = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_prefer_collection_expression = true:suggestion
# ── Braces — omit when possible ─────────────────────────────────
csharp_prefer_braces = false:suggestion
# ── Modifier preferences ───────────────────────────────────────
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
csharp_prefer_static_anonymous_function = true:suggestion
# ── Formatting — wrapping ──────────────────────────────────────
csharp_wrap_parameters_style = chop_if_long
csharp_max_line_length = 120
csharp_wrap_before_comma = false
csharp_wrap_after_dot_in_method_calls = true
# ── Formatting — new lines ──────────────────────────────────────
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
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# ── Formatting — indentation ───────────────────────────────────
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_block_contents = true
csharp_indent_braces = false
# ── Formatting — spacing ───────────────────────────────────────
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
# ── Blank lines — minimal whitespace ───────────────────────────
# No enforcement of blank lines between members (allows dense property groups)
dotnet_style_allow_multiple_blank_lines_experimental = false:suggestion
csharp_style_allow_embedded_statements_on_same_line_experimental = true:suggestion
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:suggestion
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false:suggestion
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false:suggestion
# ─── Naming ─────────────────────────────────────────────────────
# Constants: PascalCase
dotnet_naming_rule.constants_should_be_pascal_case.severity = warning
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
dotnet_naming_rule.constants_should_be_pascal_case.style = pascal_case
dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_style.pascal_case.capitalization = pascal_case
# Private fields: _camelCase
dotnet_naming_rule.private_fields_should_be_camel_case.severity = warning
dotnet_naming_rule.private_fields_should_be_camel_case.symbols = private_fields
dotnet_naming_rule.private_fields_should_be_camel_case.style = underscore_prefix
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, private_protected
dotnet_naming_style.underscore_prefix.capitalization = camel_case
dotnet_naming_style.underscore_prefix.required_prefix = _
# Private static fields: s_camelCase
dotnet_naming_rule.private_static_fields.severity = suggestion
dotnet_naming_rule.private_static_fields.symbols = private_static_fields
dotnet_naming_rule.private_static_fields.style = s_prefix
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private
dotnet_naming_symbols.private_static_fields.required_modifiers = static
dotnet_naming_style.s_prefix.capitalization = camel_case
dotnet_naming_style.s_prefix.required_prefix = s_
# Interfaces: IPascalCase
dotnet_naming_rule.interfaces_should_begin_with_i.severity = warning
dotnet_naming_rule.interfaces_should_begin_with_i.symbols = interfaces
dotnet_naming_rule.interfaces_should_begin_with_i.style = i_prefix
dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_style.i_prefix.capitalization = pascal_case
dotnet_naming_style.i_prefix.required_prefix = I
# Type parameters: TPascalCase
dotnet_naming_rule.type_parameters_should_begin_with_t.severity = warning
dotnet_naming_rule.type_parameters_should_begin_with_t.symbols = type_parameters
dotnet_naming_rule.type_parameters_should_begin_with_t.style = t_prefix
dotnet_naming_symbols.type_parameters.applicable_kinds = type_parameter
dotnet_naming_style.t_prefix.capitalization = pascal_case
dotnet_naming_style.t_prefix.required_prefix = T
# Async methods: PascalCaseAsync
dotnet_naming_rule.async_methods_should_end_with_async.severity = suggestion
dotnet_naming_rule.async_methods_should_end_with_async.symbols = async_methods
dotnet_naming_rule.async_methods_should_end_with_async.style = async_suffix
dotnet_naming_symbols.async_methods.applicable_kinds = method
dotnet_naming_symbols.async_methods.required_modifiers = async
dotnet_naming_style.async_suffix.capitalization = pascal_case
dotnet_naming_style.async_suffix.required_suffix = Async
# All other public/internal: PascalCase
dotnet_naming_rule.public_members_should_be_pascal_case.severity = warning
dotnet_naming_rule.public_members_should_be_pascal_case.symbols = public_members
dotnet_naming_rule.public_members_should_be_pascal_case.style = pascal_case
dotnet_naming_symbols.public_members.applicable_kinds = namespace, class, struct, enum, property, method, event, delegate
dotnet_naming_symbols.public_members.applicable_accessibilities = public, internal
# Parameters/locals: camelCase
dotnet_naming_rule.parameters_should_be_camel_case.severity = warning
dotnet_naming_rule.parameters_should_be_camel_case.symbols = parameters
dotnet_naming_rule.parameters_should_be_camel_case.style = camel_case_style
dotnet_naming_symbols.parameters.applicable_kinds = parameter, local
dotnet_naming_style.camel_case_style.capitalization = camel_case
# ─── Analyzer severities ───────────────────────────────────────
# CA1054: URI parameters should not be strings (too noisy)
dotnet_diagnostic.CA1054.severity = none
# CA1056: URI properties should not be strings (intentional for config binding)
dotnet_diagnostic.CA1056.severity = none
# CA1062: Validate arguments of public methods (we use ArgumentNullException guards)
dotnet_diagnostic.CA1062.severity = none
# CA2007: ConfigureAwait (library code)
dotnet_diagnostic.CA2007.severity = suggestion
# CA1822: Mark members as static (noisy on test helpers)
dotnet_diagnostic.CA1822.severity = suggestion
# CA1848: Use LoggerMessage delegates (overkill for small library)
dotnet_diagnostic.CA1848.severity = none
# CA1873: Logging performance (acceptable for small library)
dotnet_diagnostic.CA1873.severity = none
# CA1307/CA1309: Specify StringComparison (too noisy)
dotnet_diagnostic.CA1307.severity = suggestion
dotnet_diagnostic.CA1309.severity = suggestion
# CA1819: Array properties (needed for JSON deserialization records)
dotnet_diagnostic.CA1819.severity = none
# CA2000: Dispose objects (false positives on handler→HttpClient ownership transfer)
dotnet_diagnostic.CA2000.severity = suggestion
# CA5400: HttpClient without CRL check (handled via conditional compilation + insecure flag)
dotnet_diagnostic.CA5400.severity = none
# IDE0058: Expression value unused (noisy)
dotnet_diagnostic.IDE0058.severity = none
# IDE0046: Convert to conditional expression (reduces readability)
dotnet_diagnostic.IDE0046.severity = none
# IDE0045: Convert to conditional expression for assignment
dotnet_diagnostic.IDE0045.severity = suggestion
# IDE0290: Use primary constructor
dotnet_diagnostic.IDE0290.severity = suggestion
# MA0048: File name must match type name (intentional grouped records)
dotnet_diagnostic.MA0048.severity = suggestion
# MA0004: ConfigureAwait (handled per-file)
dotnet_diagnostic.MA0004.severity = suggestion
# MA0051: Method is too long (trust our judgement)
dotnet_diagnostic.MA0051.severity = none
# MA0046: Use EventArgs.Empty (not relevant)
dotnet_diagnostic.MA0046.severity = none
# ─── Test project overrides ─────────────────────────────────────
[tests/**/*.cs]
dotnet_diagnostic.CA1031.severity = none
dotnet_diagnostic.CA1063.severity = none
dotnet_diagnostic.CA1515.severity = none
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.CA1812.severity = none
dotnet_diagnostic.CA1816.severity = none
dotnet_diagnostic.CA1822.severity = none
dotnet_diagnostic.CA2007.severity = none
dotnet_diagnostic.CA2234.severity = none
dotnet_diagnostic.MA0004.severity = none
dotnet_diagnostic.MA0074.severity = none
dotnet_naming_rule.async_methods_should_end_with_async.severity = none
# ─── Sample project overrides ──────────────────────────────────
[src/**/*.cs]
dotnet_diagnostic.CA1056.severity = none
dotnet_diagnostic.CA1303.severity = none
dotnet_diagnostic.CA1305.severity = none
dotnet_diagnostic.CA1308.severity = none
dotnet_diagnostic.CA1515.severity = none
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.CA1812.severity = none
dotnet_diagnostic.CA1822.severity = none
dotnet_diagnostic.CA1031.severity = none
dotnet_diagnostic.CA1024.severity = none
dotnet_diagnostic.CA1310.severity = none
dotnet_diagnostic.CA1849.severity = none
dotnet_diagnostic.CA1870.severity = none
dotnet_diagnostic.CA2007.severity = none
dotnet_diagnostic.IDE1006.severity = none
dotnet_diagnostic.MA0002.severity = none
dotnet_diagnostic.MA0004.severity = none
dotnet_diagnostic.MA0009.severity = none
dotnet_diagnostic.MA0011.severity = none
dotnet_diagnostic.MA0023.severity = none
dotnet_diagnostic.MA0074.severity = none
csharp_style_prefer_top_level_statements = true:silent