-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.editorconfig
More file actions
275 lines (233 loc) · 13.3 KB
/
Copy path.editorconfig
File metadata and controls
275 lines (233 loc) · 13.3 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
# SolSharp - editorconfig
# Modern C# 14. The meaningful modernizers are warnings, not hints, so legacy
# patterns surface on build (EnforceCodeStyleInBuild is set in Directory.Build.props).
root = true
# ── All files ────────────────────────────────────────────────────────────────
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.{csproj,props,targets,xml}]
indent_size = 2
[*.{json,yml,yaml}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false
# ── C# ───────────────────────────────────────────────────────────────────────
[*.cs]
indent_size = 4
tab_width = 4
max_line_length = 120
file_header_template = unset
# Usings
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
csharp_using_directive_placement = outside_namespace:warning
dotnet_diagnostic.IDE0005.severity = warning
# Namespaces: file-scoped, matching folders
csharp_style_namespace_declarations = file_scoped:warning
dotnet_style_namespace_match_folder = true:warning
# No this., predefined type keywords (int, not Int32)
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
# Public API is intentional even when no in-solution consumer references it.
# Rider cannot infer external NuGet consumers from solution-wide usage.
resharper_member_can_be_private_global_highlighting = none
# Keep defensive fallback arms for invalid enum/wire values. Rider's integer
# analysis may consider them unreachable after an earlier range validation.
resharper_unreachable_switch_arm_due_to_integer_analysis_highlighting = none
# Factory-created types intentionally hide their constructors; this does not
# mean that the class cannot produce instances through its public API.
resharper_class_cannot_be_instantiated_highlighting = none
# RPC DTOs validate malformed runtime JSON even where their public NRT contract
# promises non-null values, especially for collection elements that STJ cannot enforce.
resharper_condition_is_always_true_or_false_according_to_nullable_api_contract_highlighting = none
# C# 14 field-backed DTO properties use `field!` to satisfy definite-assignment
# analysis while their init accessor validates JSON. Replacing this getter with an
# auto-accessor triggers compiler warning CS9264.
resharper_redundant_accessor_body_highlighting = none
# var everywhere
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = true:warning
# Expression-bodied members
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = true:warning
csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_accessors = true:warning
csharp_style_expression_bodied_lambdas = true:warning
csharp_style_expression_bodied_local_functions = true:suggestion
# Modern language features: primary constructors, collection expressions, target-typed new
csharp_style_prefer_primary_constructors = true:warning
dotnet_style_prefer_collection_expression = when_types_loosely_match:warning
dotnet_style_object_initializer = true:warning
dotnet_style_collection_initializer = true:warning
# Prevent anonymous functions from accidentally capturing state and allocating closures.
csharp_prefer_static_anonymous_function = true:warning
dotnet_diagnostic.IDE0320.severity = warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
# Keep Rider/ReSharper aligned with Roslyn even when a developer's global IDE
# preference requires an explicit type in object creation expressions.
resharper_csharp_object_creation_when_type_evident = target_typed
resharper_csharp_object_creation_when_type_not_evident = target_typed
resharper_arrange_object_creation_when_type_evident_highlighting = warning
resharper_arrange_object_creation_when_type_not_evident_highlighting = warning
csharp_prefer_simple_default_expression = true:warning
# Pattern matching / switch expressions over the old ways
csharp_style_prefer_switch_expression = true:warning
csharp_style_prefer_pattern_matching = true:warning
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_not_pattern = true:warning
csharp_style_prefer_extended_property_pattern = true:warning
csharp_style_prefer_null_check_over_type_check = true:warning
# Null handling: is null / is not null, ?. , ??
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_null_propagation = true:warning
dotnet_style_coalesce_expression = true:warning
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:warning
# Inline & discard
csharp_style_inlined_variable_declaration = true:warning
csharp_style_unused_value_assignment_preference = discard_variable:warning
csharp_style_deconstructed_variable_declaration = true:suggestion
# Index / range, simplified expressions, readonly
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_range_operator = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_simplified_boolean_expressions = true:warning
dotnet_style_prefer_simplified_interpolation = true:warning
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_readonly_field = true:warning
csharp_prefer_static_local_function = true:warning
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_prefer_method_group_conversion = true:silent
# Braces: allow brace-less single-line statements
csharp_prefer_braces = when_multiline:silent
csharp_prefer_simple_using_statement = true:warning
# Unused parameters
dotnet_code_quality_unused_parameters = all:warning
# New lines (Allman)
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_between_query_expression_clauses = true
# Attributes always on their own line, never inline with the member (Rider/ReSharper)
resharper_csharp_place_attribute_on_same_line = false
# Indentation / spacing
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_space_around_binary_operators = before_and_after
csharp_blank_lines_around_member = 1
# One explicit modifier order for Rider, Roslyn/dotnet format, and StyleCop SA1206.
# In particular: `static readonly` and `override async`, never the inverse.
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning
dotnet_diagnostic.IDE0036.severity = warning
# StyleCop defaults are build-gated. Disable only rules that conflict with the
# established repository conventions or impose legacy boilerplate/layout.
# Repository conventions: no `this.` qualification, `_camelCase` private fields,
# optional braces for single-line statements, and no mandatory file headers.
dotnet_diagnostic.SA1101.severity = none
dotnet_diagnostic.SA1309.severity = none
dotnet_diagnostic.SA1503.severity = none
dotnet_diagnostic.SA1519.severity = none
dotnet_diagnostic.SA1520.severity = none
dotnet_diagnostic.SA1633.severity = none
# RS0030 build-gates the banned-API list in BannedSymbols.txt. It is an error rather than a warning so the
# rules it carries (currently the permanent ConfigureAwait ban) cannot be reintroduced by a local build that
# is not run with -warnaserror.
dotnet_diagnostic.RS0030.severity = error
# CS1591 build-gates the presence of XML documentation on production public API.
# Completeness is a review policy; StyleCop's fixed wording/internal-element rules
# conflict with the repository's concise contract style and are disabled explicitly.
dotnet_diagnostic.SA1600.severity = none
dotnet_diagnostic.SA1601.severity = none
dotnet_diagnostic.SA1611.severity = none
dotnet_diagnostic.SA1615.severity = none
dotnet_diagnostic.SA1623.severity = none
dotnet_diagnostic.SA1642.severity = none
dotnet_diagnostic.SA1643.severity = none
# Keep members in the explicit StyleCop order from stylecop.json:
# kind -> accessibility -> constant -> static -> readonly. This groups fields,
# constructors, properties, methods, and nested types; within each kind the
# public API comes first and private implementation details come last.
dotnet_diagnostic.SA1201.severity = warning
dotnet_diagnostic.SA1202.severity = warning
dotnet_diagnostic.SA1203.severity = warning
dotnet_diagnostic.SA1204.severity = warning
dotnet_diagnostic.SA1214.severity = warning
# Remaining legacy layout preferences are not part of the repository contract.
dotnet_diagnostic.SA1122.severity = none
dotnet_diagnostic.SA1128.severity = none
dotnet_diagnostic.SA1402.severity = none
dotnet_diagnostic.SA1413.severity = none
dotnet_diagnostic.SA1515.severity = none
dotnet_diagnostic.SA1649.severity = none
# ── Naming ───────────────────────────────────────────────────────────────────
# Interfaces: IPascalCase
dotnet_naming_rule.interfaces_i_prefix.severity = warning
dotnet_naming_rule.interfaces_i_prefix.symbols = interfaces
dotnet_naming_rule.interfaces_i_prefix.style = i_pascal_case
dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_style.i_pascal_case.required_prefix = I
dotnet_naming_style.i_pascal_case.capitalization = pascal_case
# Type parameters: TPascalCase
dotnet_naming_rule.type_parameters_t_prefix.severity = warning
dotnet_naming_rule.type_parameters_t_prefix.symbols = type_parameters
dotnet_naming_rule.type_parameters_t_prefix.style = t_pascal_case
dotnet_naming_symbols.type_parameters.applicable_kinds = type_parameter
dotnet_naming_style.t_pascal_case.required_prefix = T
dotnet_naming_style.t_pascal_case.capitalization = pascal_case
# Types and public members: PascalCase
dotnet_naming_rule.types_and_members_pascal.severity = warning
dotnet_naming_rule.types_and_members_pascal.symbols = types_and_members
dotnet_naming_rule.types_and_members_pascal.style = pascal_case
# Rider splits canonical curve and release-layout names differently from Roslyn.
dotnet_naming_rule.types_and_members_pascal.resharper_style = AaBb, Secp256r1+AaBb, Secp256k1+AaBb, VoteState+AaBb_AaBb
dotnet_naming_symbols.types_and_members.applicable_kinds = class, struct, enum, property, method, event, delegate, namespace
dotnet_naming_style.pascal_case.capitalization = pascal_case
# Preserve versioned enum names such as V1_14_11 while keeping PascalCase as the default.
resharper_csharp_naming_rule.enum_member = AaBb, V+AaBb_AaBb
# Constants: PascalCase
dotnet_naming_rule.constants_pascal.severity = warning
dotnet_naming_rule.constants_pascal.symbols = constant_fields
dotnet_naming_rule.constants_pascal.style = pascal_case
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
# Static readonly fields: PascalCase (must precede the private-field rule below)
dotnet_naming_rule.static_readonly_pascal.severity = warning
dotnet_naming_rule.static_readonly_pascal.symbols = static_readonly_fields
dotnet_naming_rule.static_readonly_pascal.style = pascal_case
dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly
# Private instance fields: _camelCase
dotnet_naming_rule.private_fields_underscore.severity = warning
dotnet_naming_rule.private_fields_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_underscore.style = underscore_camel_case
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.underscore_camel_case.required_prefix = _
dotnet_naming_style.underscore_camel_case.capitalization = camel_case
# Parameters and locals: camelCase
dotnet_naming_rule.parameters_camel.severity = warning
dotnet_naming_rule.parameters_camel.symbols = parameters_and_locals
dotnet_naming_rule.parameters_camel.style = camel_case
dotnet_naming_symbols.parameters_and_locals.applicable_kinds = parameter, local
dotnet_naming_style.camel_case.capitalization = camel_case
# ── Tests ────────────────────────────────────────────────────────────────────
# Test methods use Method_Scenario_Expectation names; don't enforce naming there.
[tests/**/*.cs]
dotnet_diagnostic.IDE1006.severity = none