1
- # Schema: http://EditorConfig.org
2
- # Docs: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
3
-
4
- # top-most EditorConfig file
1
+ # ##############################
2
+ # Core EditorConfig Options #
3
+ # ##############################
5
4
root = true
6
-
7
- # Don't use tabs for indentation.
5
+ # All files
8
6
[* ]
9
7
indent_style = space
10
- trim_trailing_whitespace = true
11
-
12
- # Code files
13
- [* .{cs,csx,vb,vbx} ]
14
- indent_size = 4
15
- indent_style = tab
16
- insert_final_newline = true
17
- # charset = utf-8-bom
18
8
19
- # Xml project files
9
+ # XML project files
20
10
[* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj} ]
21
11
indent_size = 2
22
12
23
- # Xml config files
24
- [* .{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,xml,stylecop} ]
25
- indent_size = 2
26
-
27
- # JSON files
28
- [* .json ]
29
- indent_size = 2
30
-
31
- # Powershell files
32
- [* .ps1 ]
33
- indent_size = 2
34
-
35
- # Shell scripts
36
- [* .sh ]
37
- end_of_line = lf
38
- indent_size = 2
39
-
40
- [* .{cmd,bat} ]
41
- end_of_line = crlf
13
+ # XML config files
14
+ [* .{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct} ]
42
15
indent_size = 2
43
16
44
- # # Language conventions
45
- # Dotnet code style settings:
17
+ # Code files
18
+ [* .{cs,csx,vb,vbx} ]
19
+ indent_size = 4
20
+ insert_final_newline = true
21
+ charset = utf-8
22
+ trim_trailing_whitespace = true
23
+ # ##############################
24
+ # .NET Coding Conventions #
25
+ # ##############################
46
26
[* .{cs,vb} ]
47
- # "This." and "Me." qualifiers
27
+ # Organize usings
28
+ dotnet_sort_system_directives_first = true
29
+ # this. preferences
48
30
dotnet_style_qualification_for_field = false :suggestion
49
31
dotnet_style_qualification_for_property = false :suggestion
50
- dotnet_style_qualification_for_method = false :suggestion
51
- dotnet_style_qualification_for_event = false :suggestion
52
-
53
- # Language keywords instead of framework type names for type references
32
+ dotnet_style_qualification_for_method = false :silent
33
+ dotnet_style_qualification_for_event = false :silent
34
+ # Language keywords vs BCL types preferences
54
35
dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
55
36
dotnet_style_predefined_type_for_member_access = true :suggestion
56
-
57
- # Modifier preferences
58
- dotnet_style_require_accessibility_modifiers = always:suggestion
59
- dotnet_style_readonly_field = true :warning
60
-
61
37
# Parentheses preferences
62
38
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
63
39
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
64
40
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
65
41
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
66
-
42
+ # Modifier preferences
43
+ dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
44
+ dotnet_style_readonly_field = true :suggestion
67
45
# Expression-level preferences
68
46
dotnet_style_object_initializer = true :suggestion
69
47
dotnet_style_collection_initializer = true :suggestion
70
48
dotnet_style_explicit_tuple_names = true :suggestion
49
+ dotnet_style_null_propagation = true :suggestion
50
+ dotnet_style_coalesce_expression = true :suggestion
51
+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :silent
71
52
dotnet_style_prefer_inferred_tuple_names = true :suggestion
72
53
dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
73
54
dotnet_style_prefer_auto_properties = true :silent
74
- dotnet_style_prefer_conditional_expression_over_assignment = true :suggestion
75
- dotnet_style_prefer_conditional_expression_over_return = true :suggestion
76
-
77
- # Null-checking preferences
78
- dotnet_style_coalesce_expression = true :suggestion
79
- dotnet_style_null_propagation = true :suggestion
80
-
81
- # CSharp code style settings:
55
+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
56
+ dotnet_style_prefer_conditional_expression_over_return = true :silent
57
+ # ##############################
58
+ # Naming Conventions #
59
+ # ##############################
60
+ # Style Definitions
61
+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
62
+ # Use PascalCase for constant fields
63
+ dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
64
+ dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
65
+ dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
66
+ dotnet_naming_symbols.constant_fields.applicable_kinds = field
67
+ dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
68
+ dotnet_naming_symbols.constant_fields.required_modifiers = const
69
+ # ##############################
70
+ # C# Coding Conventions #
71
+ # ##############################
82
72
[* .cs ]
83
- # Modifier preferences
84
- csharp_preferred_modifier_order = public,private,protected,internal,const,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
85
-
86
- # Implicit and explicit types
73
+ # var preferences
87
74
csharp_style_var_for_built_in_types = true :suggestion
88
75
csharp_style_var_when_type_is_apparent = true :suggestion
89
76
csharp_style_var_elsewhere = true :suggestion
90
-
91
77
# Expression-bodied members
92
- # Explicitly disabled due to difference in coding style between source and tests
93
- # csharp_style_expression_bodied_methods = false:silent
94
- # csharp_style_expression_bodied_constructors = false:silent
78
+ csharp_style_expression_bodied_methods = false :silent
79
+ csharp_style_expression_bodied_constructors = false :silent
95
80
csharp_style_expression_bodied_operators = false :silent
96
- csharp_style_expression_bodied_properties = true :suggestion
97
- csharp_style_expression_bodied_indexers = true :suggestion
98
- csharp_style_expression_bodied_accessors = true :suggestion
99
-
100
- # Pattern matching
81
+ csharp_style_expression_bodied_properties = true :silent
82
+ csharp_style_expression_bodied_indexers = true :silent
83
+ csharp_style_expression_bodied_accessors = true :silent
84
+ # Pattern matching preferences
101
85
csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
102
86
csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
103
-
104
- # Inlined variable declarations
105
- csharp_style_inlined_variable_declaration = true :suggestion
106
-
107
- # Expression-level preferences
108
- csharp_prefer_simple_default_expression = true :suggestion
109
- csharp_style_deconstructed_variable_declaration = true :suggestion
110
- csharp_style_pattern_local_over_anonymous_function = true :suggestion
111
-
112
- # Null-checking preference
87
+ # Null-checking preferences
113
88
csharp_style_throw_expression = true :suggestion
114
89
csharp_style_conditional_delegate_call = true :suggestion
115
-
116
- # Code block preferences
117
- csharp_prefer_braces = true :suggestion
118
-
119
- # # Formatting conventions
120
- # Dotnet formatting settings:
121
- [* .{cs,vb} ]
122
- # Organize usings
123
- dotnet_sort_system_directives_first = true
124
- dotnet_separate_import_directive_groups = false
125
-
126
- # CSharp formatting settings:
127
- [* .cs ]
128
- # Newline options
90
+ # Modifier preferences
91
+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
92
+ # Expression-level preferences
93
+ csharp_prefer_braces = true # Prefer curly braces even for one line of code
94
+ csharp_style_deconstructed_variable_declaration = true :suggestion
95
+ csharp_prefer_simple_default_expression = true :suggestion
96
+ # csharp_style_prefer_local_over_anonymous_function = true:suggestion
97
+ csharp_style_inlined_variable_declaration = true :suggestion
98
+ # ##############################
99
+ # C# Formatting Rules #
100
+ # ##############################
101
+ # New line preferences
129
102
csharp_new_line_before_open_brace = all
130
103
csharp_new_line_before_else = true
131
104
csharp_new_line_before_catch = true
132
105
csharp_new_line_before_finally = true
133
106
csharp_new_line_before_members_in_object_initializers = true
134
107
csharp_new_line_before_members_in_anonymous_types = true
135
108
csharp_new_line_between_query_expression_clauses = true
136
-
137
- # Identation options
138
- csharp_indent_block_contents = true
139
- csharp_indent_braces = false
140
- csharp_indent_case_contents_when_block = true
141
- csharp_indent_switch_labels = true
109
+ # Indentation preferences
142
110
csharp_indent_case_contents = true
143
- csharp_indent_labels = no_change
144
-
145
- # Spacing options
111
+ csharp_indent_switch_labels = true
112
+ csharp_indent_labels = flush_left
113
+ # Space preferences
146
114
csharp_space_after_cast = false
147
115
csharp_space_after_keywords_in_control_flow_statements = true
148
- csharp_space_between_method_declaration_parameter_list_parentheses = false
149
116
csharp_space_between_method_call_parameter_list_parentheses = false
117
+ csharp_space_between_method_declaration_parameter_list_parentheses = false
150
118
csharp_space_between_parentheses = false
151
119
csharp_space_before_colon_in_inheritance_clause = true
152
120
csharp_space_after_colon_in_inheritance_clause = true
153
121
csharp_space_around_binary_operators = before_and_after
154
122
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
155
123
csharp_space_between_method_call_name_and_opening_parenthesis = false
156
124
csharp_space_between_method_call_empty_parameter_list_parentheses = false
157
- csharp_space_after_comma = true
158
- csharp_space_after_dot = false
159
- csharp_space_after_semicolon_in_for_statement = true
160
- csharp_space_around_declaration_statements = do_not_ignore
161
- csharp_space_before_comma = false
162
- csharp_space_before_dot = false
163
- csharp_space_before_open_square_brackets = false
164
- csharp_space_before_semicolon_in_for_statement = false
165
- csharp_space_between_empty_square_brackets = false
166
- csharp_space_between_method_declaration_name_and_open_parenthesis = false
167
- csharp_space_between_square_brackets = false
168
-
169
- # Wrap options
125
+ # Wrapping preferences
170
126
csharp_preserve_single_line_statements = true
171
127
csharp_preserve_single_line_blocks = true
172
128
173
- # # Naming conventions
174
- [ * .{cs,vb} ]
129
+ # Namespace settings
130
+ # csharp_style_namespace_declarations = file_scoped
175
131
176
- # # Naming styles
177
-
178
- dotnet_naming_style.pascal_case_style.capitalization = pascal_case
179
- dotnet_naming_style.camel_case_style.capitalization = camel_case
180
-
181
- # PascalCase with I prefix
182
- dotnet_naming_style.interface_style.capitalization = pascal_case
183
- dotnet_naming_style.interface_style.required_prefix = I
184
-
185
- # PascalCase with T prefix
186
- dotnet_naming_style.type_parameter_style.capitalization = pascal_case
187
- dotnet_naming_style.type_parameter_style.required_prefix = T
188
-
189
- # camelCase with _ prefix
190
- dotnet_naming_style._camelCase.capitalization = camel_case
191
- dotnet_naming_style._camelCase.required_prefix = _
192
-
193
- # # Rules
194
- # Interfaces
195
- dotnet_naming_symbols.interface_symbol.applicable_kinds = interface
196
- dotnet_naming_symbols.interface_symbol.applicable_accessibilities = *
197
- dotnet_naming_rule.interface_naming.symbols = interface_symbol
198
- dotnet_naming_rule.interface_naming.style = interface_style
199
- dotnet_naming_rule.interface_naming.severity = suggestion
200
-
201
- # Classes, Structs, Enums, Properties, Methods, Events, Namespaces
202
- dotnet_naming_symbols.class_symbol.applicable_kinds = class, struct, enum, property, method, event, namespace
203
- dotnet_naming_symbols.class_symbol.applicable_accessibilities = *
204
-
205
- dotnet_naming_rule.class_naming.symbols = class_symbol
206
- dotnet_naming_rule.class_naming.style = pascal_case_style
207
- dotnet_naming_rule.class_naming.severity = suggestion
208
-
209
- # Type Parameters
210
- dotnet_naming_symbols.type_parameter_symbol.applicable_kinds = type_parameter
211
- dotnet_naming_symbols.type_parameter_symbol.applicable_accessibilities = *
212
-
213
- dotnet_naming_rule.type_parameter_naming.symbols = type_parameter_symbol
214
- dotnet_naming_rule.type_parameter_naming.style = type_parameter_style
215
- dotnet_naming_rule.type_parameter_naming.severity = suggestion
216
-
217
- # Private const fields
218
- dotnet_naming_symbols.const_field_symbol.applicable_kinds = field
219
- dotnet_naming_symbols.const_field_symbol.applicable_accessibilities = private
220
- dotnet_naming_symbols.const_field_symbol.required_modifiers = const
221
-
222
- dotnet_naming_rule.const_field_naming.symbols = const_field_symbol
223
- dotnet_naming_rule.const_field_naming.style = _camelCase
224
- dotnet_naming_rule.const_field_naming.severity = suggestion
225
-
226
- # Other const fields
227
- dotnet_naming_symbols.const_field_symbol.applicable_kinds = field
228
- dotnet_naming_symbols.const_field_symbol.applicable_accessibilities = *
229
- dotnet_naming_symbols.const_field_symbol.required_modifiers = const
230
-
231
- dotnet_naming_rule.const_field_naming.symbols = const_field_symbol
232
- dotnet_naming_rule.const_field_naming.style = pascal_case_style
233
- dotnet_naming_rule.const_field_naming.severity = suggestion
234
-
235
- # Public fields
236
- dotnet_naming_symbols.public_field_symbol.applicable_kinds = field
237
- dotnet_naming_symbols.public_field_symbol.applicable_accessibilities = public, internal, protected, protected_internal, private_protected
238
-
239
- dotnet_naming_rule.public_field_naming.symbols = public_field_symbol
240
- dotnet_naming_rule.public_field_naming.style = pascal_case_style
241
- dotnet_naming_rule.public_field_naming.severity = suggestion
242
-
243
- # Other fields
244
- dotnet_naming_symbols.other_field_symbol.applicable_kinds = field
245
- dotnet_naming_symbols.other_field_symbol.applicable_accessibilities = *
246
-
247
- dotnet_naming_rule.other_field_naming.symbols = other_field_symbol
248
- dotnet_naming_rule.other_field_naming.style = _camelCase
249
- dotnet_naming_rule.other_field_naming.severity = suggestion
132
+ [* .json ]
133
+ indent_size = 2
250
134
251
- # Everything Else
252
- dotnet_naming_symbols.everything_else.applicable_kinds = *
253
- dotnet_naming_symbols.everything_else.applicable_accessibilities = *
135
+ [* .{ps1,psm1} ]
136
+ indent_size = 4
254
137
255
- dotnet_naming_rule.everything_else_naming.symbols = everything_else
256
- dotnet_naming_rule.everything_else_naming.style = camel_case_style
257
- dotnet_naming_rule.everything_else_naming.severity = suggestion
138
+ [ * .sh ]
139
+ indent_size = 4
140
+ end_of_line = lf
0 commit comments