-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.editorconfig
More file actions
197 lines (146 loc) · 6.99 KB
/
Copy path.editorconfig
File metadata and controls
197 lines (146 loc) · 6.99 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
root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8-bom
end_of_line = crlf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{csproj,props,targets,xml,json,yml,yaml}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[*.cs]
# ---- Naming conventions ----
# Interfaces must start with I
dotnet_naming_rule.interface_should_begin_with_i.severity = error
dotnet_naming_rule.interface_should_begin_with_i.symbols = interface
dotnet_naming_rule.interface_should_begin_with_i.style = begins_with_i
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.capitalization = pascal_case
# Public members — PascalCase
dotnet_naming_rule.public_members_pascal.severity = error
dotnet_naming_rule.public_members_pascal.symbols = public_symbols
dotnet_naming_rule.public_members_pascal.style = pascal_style
dotnet_naming_symbols.public_symbols.applicable_kinds = property, method, event, delegate, class, struct, enum
dotnet_naming_symbols.public_symbols.applicable_accessibilities = public, internal, protected, protected_internal
dotnet_naming_style.pascal_style.capitalization = pascal_case
# Private fields — _camelCase
dotnet_naming_rule.private_fields_underscore.severity = error
dotnet_naming_rule.private_fields_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_underscore.style = underscore_camel
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, private_protected
dotnet_naming_style.underscore_camel.required_prefix = _
dotnet_naming_style.underscore_camel.capitalization = camel_case
# Local variables and parameters — camelCase
dotnet_naming_rule.locals_camel.severity = error
dotnet_naming_rule.locals_camel.symbols = locals
dotnet_naming_rule.locals_camel.style = camel_style
dotnet_naming_symbols.locals.applicable_kinds = parameter, local
dotnet_naming_style.camel_style.capitalization = camel_case
# Constants — PascalCase
dotnet_naming_rule.constants_pascal.severity = error
dotnet_naming_rule.constants_pascal.symbols = constants
dotnet_naming_rule.constants_pascal.style = pascal_style
dotnet_naming_symbols.constants.applicable_kinds = field
dotnet_naming_symbols.constants.required_modifiers = const
# ---- Code style ----
# var preferences
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 = when_on_single_line:suggestion
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
csharp_style_expression_bodied_lambdas = true:suggestion
# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null checking
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
# Using directives
csharp_using_directive_placement = outside_namespace:error
# Namespace declarations
csharp_style_namespace_declarations = file_scoped:error
# ---- Formatting ----
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_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
# ---- Suppressed rules ----
# IDE0058 — expression value never used (noisy in tests and endpoint handlers)
dotnet_diagnostic.IDE0058.severity = none
# IDE0130 — namespace does not match folder structure
dotnet_diagnostic.IDE0130.severity = none
# CA1062 — validate arguments of public methods (redundant with nullable reference types)
dotnet_diagnostic.CA1062.severity = none
# CA1848 — use LoggerMessage delegates (over-engineering for a small project)
dotnet_diagnostic.CA1848.severity = none
# CA1034 — nested types should not be visible (common pattern for DTOs)
dotnet_diagnostic.CA1034.severity = none
# CA1515 — public types in exe should be internal (conflicts with module pattern)
dotnet_diagnostic.CA1515.severity = none
# CA1050 — declare types in namespaces (Program.cs top-level)
dotnet_diagnostic.CA1050.severity = none
# CA1724 — type names should not match namespaces
dotnet_diagnostic.CA1724.severity = none
# CA2007 — consider calling ConfigureAwait (not needed in ASP.NET Core)
dotnet_diagnostic.CA2007.severity = none
# CA1711 — identifiers should not have incorrect suffix (xUnit collections, EventHandler, Permission)
dotnet_diagnostic.CA1711.severity = none
# CA1716 — identifiers should not match keywords
dotnet_diagnostic.CA1716.severity = none
# RCS1090 — add ConfigureAwait (not needed in ASP.NET Core)
dotnet_diagnostic.RCS1090.severity = none
# RCS1194 — implement exception constructors (over-engineering)
dotnet_diagnostic.RCS1194.severity = none
# CA2227 — collection properties should be read-only (DTOs need setters for deserialization)
dotnet_diagnostic.CA2227.severity = none
# CA1002 — do not expose List<T> (DTOs are simple data containers)
dotnet_diagnostic.CA1002.severity = none
# IDE0046 — convert to conditional expression (reduces readability)
dotnet_diagnostic.IDE0046.severity = none
# IDE0010 — add missing cases to switch (noisy for enums)
dotnet_diagnostic.IDE0010.severity = none
# IDE0072 — add missing cases to switch expression
dotnet_diagnostic.IDE0072.severity = none
# Generated code
[*.Generated.cs]
generated_code = true
# EF Core migrations (auto-generated — suppress strict analysis)
[**/Migrations/*.cs]
generated_code = true
[*.g.cs]
generated_code = true
# ---- Endpoint relaxations ----
[**/Endpoints/**/*.cs]
# CA1812 — internal payload classes instantiated by ASP.NET model binding
dotnet_diagnostic.CA1812.severity = none
[**/Pages/**/*Endpoint.cs]
# CA1812 — internal payload classes instantiated by ASP.NET model binding
dotnet_diagnostic.CA1812.severity = none
[**/Pages/*Endpoint.cs]
# CA1812 — internal payload classes instantiated by ASP.NET model binding
dotnet_diagnostic.CA1812.severity = none
# ---- Test project relaxations ----
[{tests,modules/*/tests}/**/*.cs]
# CA1707 — underscore in test method names (standard convention)
dotnet_diagnostic.CA1707.severity = none
# CA1812 — internal class never instantiated (test helper classes)
dotnet_diagnostic.CA1812.severity = none
# CA2234 — use Uri overload (test HTTP clients use string paths)
dotnet_diagnostic.CA2234.severity = none
# xUnit1051 — use CancellationToken (over-engineering for test methods)
dotnet_diagnostic.xUnit1051.severity = none