1
+ # top-most EditorConfig file
2
+ root = true
3
+
4
+ # Don't use tabs for indentation.
5
+ [* ]
6
+ indent_style = space
7
+ # (Please don't specify an indent_size here; that has too many unintended consequences.)
8
+
9
+ # Code files
10
+ [* .{cs,csx} ]
11
+ indent_size = 4
12
+ insert_final_newline = true
13
+ charset = utf-8
14
+ end_of_line = lf
15
+
16
+ # XML project files
17
+ [* .{csproj,proj,projitems,shproj} ]
18
+ indent_size = 2
19
+ end_of_line = crlf
20
+
21
+ # XML config files
22
+ [* .{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct} ]
23
+ indent_size = 2
24
+
25
+ # JSON files
26
+ [* .json ]
27
+ indent_size = 2
28
+
29
+ # Powershell files
30
+ [* .ps1 ]
31
+ indent_size = 2
32
+
33
+ # Shell script files
34
+ [* .sh ]
35
+ end_of_line = lf
36
+ indent_size = 2
37
+
38
+ # Dotnet code style settings:
39
+ [* .{cs} ]
40
+
41
+ # IDE0055: Fix formatting
42
+ dotnet_diagnostic.IDE0055.severity = warning
43
+
44
+ # Sort using and Import directives with System.* appearing first
45
+ dotnet_sort_system_directives_first = false
46
+ dotnet_separate_import_directive_groups = false
47
+ # Avoid "this." and "Me." if not necessary
48
+ dotnet_style_qualification_for_field = false
49
+ dotnet_style_qualification_for_property = false
50
+ dotnet_style_qualification_for_method = false
51
+ dotnet_style_qualification_for_event = false
52
+
53
+ # Use language keywords instead of framework type names for type references
54
+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
55
+ dotnet_style_predefined_type_for_member_access = true :suggestion
56
+
57
+ # Suggest more modern language features when available
58
+ dotnet_style_object_initializer = true :suggestion
59
+ dotnet_style_collection_initializer = true :suggestion
60
+ dotnet_style_coalesce_expression = true :suggestion
61
+ dotnet_style_null_propagation = true :suggestion
62
+ dotnet_style_explicit_tuple_names = true :suggestion
63
+
64
+ # Whitespace options
65
+ dotnet_style_allow_multiple_blank_lines_experimental = false
66
+
67
+ # Non-private static fields are PascalCase
68
+ dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
69
+ dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
70
+ dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
71
+
72
+ dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
73
+ dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
74
+ dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
75
+
76
+ dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
77
+
78
+ # Non-private readonly fields are PascalCase
79
+ dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
80
+ dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
81
+ dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
82
+
83
+ dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
84
+ dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
85
+ dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
86
+
87
+ dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
88
+
89
+ # Constants are PascalCase
90
+ dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
91
+ dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
92
+ dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
93
+
94
+ dotnet_naming_symbols.constants.applicable_kinds = field, local
95
+ dotnet_naming_symbols.constants.required_modifiers = const
96
+
97
+ dotnet_naming_style.constant_style.capitalization = pascal_case
98
+
99
+ # Static fields are camelCase and start with s_
100
+ dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
101
+ dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
102
+ dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
103
+
104
+ dotnet_naming_symbols.static_fields.applicable_kinds = field
105
+ dotnet_naming_symbols.static_fields.required_modifiers = static
106
+
107
+ dotnet_naming_style.static_field_style.capitalization = pascal_case
108
+
109
+ # Instance fields are camelCase and start with _
110
+ dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
111
+ dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
112
+ dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
113
+
114
+ dotnet_naming_symbols.instance_fields.applicable_kinds = field
115
+
116
+ dotnet_naming_style.instance_field_style.capitalization = camel_case
117
+ dotnet_naming_style.instance_field_style.required_prefix = _
118
+
119
+ # Locals and parameters are camelCase
120
+ dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
121
+ dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
122
+ dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
123
+
124
+ dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
125
+
126
+ dotnet_naming_style.camel_case_style.capitalization = camel_case
127
+
128
+ # Local functions are PascalCase
129
+ dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
130
+ dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
131
+ dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
132
+
133
+ dotnet_naming_symbols.local_functions.applicable_kinds = local_function
134
+
135
+ dotnet_naming_style.local_function_style.capitalization = pascal_case
136
+
137
+ # By default, name items with PascalCase
138
+ dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
139
+ dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
140
+ dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
141
+
142
+ dotnet_naming_symbols.all_members.applicable_kinds = *
143
+
144
+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
145
+
146
+ # error RS2008: Enable analyzer release tracking for the analyzer project containing rule '{0}'
147
+ dotnet_diagnostic.RS2008.severity = none
148
+
149
+ # IDE0073: File header
150
+ dotnet_diagnostic.IDE0073.severity = warning
151
+ # file_header_template = /********************************************************************************\n * Copyright (c) 2024 Contributors to the CatenaX (ng) GitHub Organisation.\n *\n * \nSee the NOTICE file(s) distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This program and the accompanying materials are made available under the\n * terms of the \nApache License, Version 2.0 which is available at\n * https://www.apache.org/licenses/LICENSE-2.0.\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License \nis distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the \nLicense. *\n * SPDX-License-Identifier: Apache-2.0\n ********************************************************************************/\n
152
+
153
+ # IDE0035: Remove unreachable code
154
+ dotnet_diagnostic.IDE0035.severity = warning
155
+
156
+ # IDE0036: Order modifiers
157
+ dotnet_diagnostic.IDE0036.severity = warning
158
+
159
+ # IDE0043: Format string contains invalid placeholder
160
+ dotnet_diagnostic.IDE0043.severity = warning
161
+
162
+ # IDE0044: Make field readonly
163
+ dotnet_diagnostic.IDE0044.severity = warning
164
+
165
+ # CONSIDER: Are IDE0051 and IDE0052 too noisy to be warnings for IDE editing scenarios? Should they be made build-only warnings?
166
+ # IDE0051: Remove unused private member
167
+ dotnet_diagnostic.IDE0051.severity = warning
168
+
169
+ # IDE0170: Prefer extended property pattern
170
+ dotnet_diagnostic.IDE0170.severity = warning
171
+
172
+ # RS0016: Only enable if API files are present
173
+ dotnet_public_api_analyzer.require_api_files = true
174
+
175
+ # dotnet_style_allow_multiple_blank_lines_experimental
176
+ dotnet_diagnostic.IDE2000.severity = warning
177
+
178
+ # CSharp code style settings:
179
+ [* .cs ]
180
+ # Newline settings
181
+ csharp_new_line_before_open_brace = all
182
+ csharp_new_line_before_else = true
183
+ csharp_new_line_before_catch = true
184
+ csharp_new_line_before_finally = true
185
+ csharp_new_line_before_members_in_object_initializers = true
186
+ csharp_new_line_before_members_in_anonymous_types = true
187
+ csharp_new_line_between_query_expression_clauses = true
188
+
189
+ # Indentation preferences
190
+ csharp_indent_block_contents = true
191
+ csharp_indent_braces = false
192
+ csharp_indent_case_contents = true
193
+ csharp_indent_case_contents_when_block = true
194
+ csharp_indent_switch_labels = true
195
+ csharp_indent_labels = flush_left
196
+
197
+ # Whitespace options
198
+ csharp_style_allow_embedded_statements_on_same_line_experimental = false
199
+ csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
200
+ csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
201
+
202
+ # Prefer "var" everywhere
203
+ csharp_style_var_for_built_in_types = true :suggestion
204
+ csharp_style_var_when_type_is_apparent = true :suggestion
205
+ csharp_style_var_elsewhere = true :suggestion
206
+
207
+ # Prefer method-like constructs to have a block body
208
+ csharp_style_expression_bodied_methods = true :none
209
+ csharp_style_expression_bodied_constructors = false :none
210
+ csharp_style_expression_bodied_operators = false :none
211
+
212
+ # Prefer property-like constructs to have an expression-body
213
+ csharp_style_expression_bodied_properties = true :none
214
+ csharp_style_expression_bodied_indexers = true :none
215
+ csharp_style_expression_bodied_accessors = true :none
216
+
217
+ # Suggest more modern language features when available
218
+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
219
+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
220
+ csharp_style_inlined_variable_declaration = true :suggestion
221
+ csharp_style_throw_expression = true :suggestion
222
+ csharp_style_conditional_delegate_call = true :suggestion
223
+ csharp_style_prefer_extended_property_pattern = true :suggestion
224
+
225
+ # Space preferences
226
+ csharp_space_after_cast = false
227
+ csharp_space_after_colon_in_inheritance_clause = true
228
+ csharp_space_after_comma = true
229
+ csharp_space_after_dot = false
230
+ csharp_space_after_keywords_in_control_flow_statements = true
231
+ csharp_space_after_semicolon_in_for_statement = true
232
+ csharp_space_around_binary_operators = before_and_after
233
+ csharp_space_around_declaration_statements = do_not_ignore
234
+ csharp_space_before_colon_in_inheritance_clause = true
235
+ csharp_space_before_comma = false
236
+ csharp_space_before_dot = false
237
+ csharp_space_before_open_square_brackets = false
238
+ csharp_space_before_semicolon_in_for_statement = false
239
+ csharp_space_between_empty_square_brackets = false
240
+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
241
+ csharp_space_between_method_call_name_and_opening_parenthesis = false
242
+ csharp_space_between_method_call_parameter_list_parentheses = false
243
+ csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
244
+ csharp_space_between_method_declaration_name_and_open_parenthesis = false
245
+ csharp_space_between_method_declaration_parameter_list_parentheses = false
246
+ csharp_space_between_parentheses = false
247
+ csharp_space_between_square_brackets = false
248
+
249
+ # Blocks are allowed
250
+ csharp_prefer_braces = true :silent
251
+ csharp_preserve_single_line_blocks = true
252
+ csharp_preserve_single_line_statements = true
253
+
254
+ # IDE0060: Remove unused parameter
255
+ dotnet_diagnostic.IDE0060.severity = warning
256
+
257
+ # IDE0011: Add braces
258
+ csharp_prefer_braces = when_multiline:warning
259
+ # NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
260
+ dotnet_diagnostic.IDE0011.severity = warning
261
+
262
+ # IDE0040: Add accessibility modifiers
263
+ dotnet_diagnostic.IDE0040.severity = warning
264
+
265
+ # IDE0052: Remove unread private member
266
+ dotnet_diagnostic.IDE0052.severity = warning
267
+
268
+ # IDE0059: Unnecessary assignment to a value
269
+ dotnet_diagnostic.IDE0059.severity = warning
270
+
271
+ # CA1012: Abstract types should not have public constructors
272
+ dotnet_diagnostic.CA1012.severity = warning
273
+
274
+ # CA1822: Make member static
275
+ dotnet_diagnostic.CA1822.severity = warning
276
+
277
+ # Prefer "var" everywhere
278
+ dotnet_diagnostic.IDE0007.severity = warning
279
+ csharp_style_var_for_built_in_types = true :warning
280
+ csharp_style_var_when_type_is_apparent = true :warning
281
+ csharp_style_var_elsewhere = true :warning
282
+
283
+ # csharp_style_allow_embedded_statements_on_same_line_experimental
284
+ dotnet_diagnostic.IDE2001.severity = warning
285
+
286
+ # csharp_style_allow_blank_lines_between_consecutive_braces_experimental
287
+ dotnet_diagnostic.IDE2002.severity = warning
288
+
289
+ # dotnet_style_allow_statement_immediately_after_block_experimental
290
+ dotnet_diagnostic.IDE2003.severity = warning
291
+
292
+ # csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental
293
+ dotnet_diagnostic.IDE2004.severity = warning
0 commit comments