1
+ # EditorConfig is awesome: https://EditorConfig.org
2
+
3
+ # top-most EditorConfig file
4
+ root = true
5
+
6
+ # Don't use tabs for indentation.
7
+ [* ]
8
+ indent_style = space
9
+ # (Please don't specify an indent_size here; that has too many unintended consequences.)
10
+
11
+ # Code files
12
+ [* .{cs,csx,vb,vbx} ]
13
+ indent_size = 4
14
+ insert_final_newline = true
15
+ charset = utf-8-bom
16
+
17
+ # XML project files
18
+ [* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj} ]
19
+ indent_size = 2
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 diagnostic settings
39
+ [* .{cs,vb} ]
40
+ dotnet_diagnostic.xUnit2018.severity = suppress # " do not compare an object's exact type to the abstract class" is a valid assert, but very noisy right now
41
+
42
+ # Dotnet code style settings:
43
+ [* .{cs,vb} ]
44
+ # Sort using and Import directives with System.* appearing first
45
+ dotnet_sort_system_directives_first = true
46
+ # Avoid "this." and "Me." if not necessary
47
+ dotnet_style_qualification_for_field = false :suggestion
48
+ dotnet_style_qualification_for_property = false :suggestion
49
+ dotnet_style_qualification_for_method = false :suggestion
50
+ dotnet_style_qualification_for_event = false :suggestion
51
+
52
+ # Use language keywords instead of framework type names for type references
53
+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
54
+ dotnet_style_predefined_type_for_member_access = true :suggestion
55
+
56
+ # Suggest more modern language features when available
57
+ dotnet_style_object_initializer = true :suggestion
58
+ dotnet_style_collection_initializer = true :suggestion
59
+ dotnet_style_coalesce_expression = true :suggestion
60
+ dotnet_style_null_propagation = true :suggestion
61
+ dotnet_style_explicit_tuple_names = true :suggestion
62
+
63
+ # Non-private static fields are PascalCase
64
+ dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
65
+ dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
66
+ dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
67
+
68
+ dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
69
+ dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected
70
+ dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
71
+
72
+ dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
73
+
74
+ # Non-private readonly fields are PascalCase
75
+ dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
76
+ dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
77
+ dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
78
+
79
+ dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
80
+ dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected
81
+ dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
82
+
83
+ dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
84
+
85
+ # Constants are PascalCase
86
+ dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
87
+ dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
88
+ dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
89
+
90
+ dotnet_naming_symbols.constants.applicable_kinds = field, local
91
+ dotnet_naming_symbols.constants.required_modifiers = const
92
+
93
+ dotnet_naming_style.constant_style.capitalization = pascal_case
94
+
95
+ # Static fields are camelCase and start with s_
96
+ dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
97
+ dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
98
+ dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
99
+
100
+ dotnet_naming_symbols.static_fields.applicable_kinds = field
101
+ dotnet_naming_symbols.static_fields.required_modifiers = static
102
+
103
+ dotnet_naming_style.static_field_style.capitalization = camel_case
104
+ dotnet_naming_style.static_field_style.required_prefix = s_
105
+
106
+ # Instance fields are camelCase and start with _
107
+ dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
108
+ dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
109
+ dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
110
+
111
+ dotnet_naming_symbols.instance_fields.applicable_kinds = field
112
+
113
+ dotnet_naming_style.instance_field_style.capitalization = camel_case
114
+ dotnet_naming_style.instance_field_style.required_prefix = _
115
+
116
+ # Locals and parameters are camelCase
117
+ dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
118
+ dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
119
+ dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
120
+
121
+ dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
122
+
123
+ dotnet_naming_style.camel_case_style.capitalization = camel_case
124
+
125
+ # Local functions are PascalCase
126
+ dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
127
+ dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
128
+ dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
129
+
130
+ dotnet_naming_symbols.local_functions.applicable_kinds = local_function
131
+
132
+ dotnet_naming_style.local_function_style.capitalization = pascal_case
133
+
134
+ # By default, name items with PascalCase
135
+ dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
136
+ dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
137
+ dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
138
+
139
+ dotnet_naming_symbols.all_members.applicable_kinds = *
140
+
141
+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
142
+
143
+ # CSharp code style settings:
144
+ [* .cs ]
145
+ # Indentation preferences
146
+ csharp_indent_block_contents = true
147
+ csharp_indent_braces = false
148
+ csharp_indent_case_contents = true
149
+ csharp_indent_case_contents_when_block = true
150
+ csharp_indent_switch_labels = true
151
+ csharp_indent_labels = flush_left
152
+
153
+ # Prefer "var" everywhere
154
+ csharp_style_var_for_built_in_types = true :suggestion
155
+ csharp_style_var_when_type_is_apparent = true :suggestion
156
+ csharp_style_var_elsewhere = true :suggestion
157
+
158
+ # Prefer method-like constructs to have a block body
159
+ csharp_style_expression_bodied_methods = false :none
160
+ csharp_style_expression_bodied_constructors = false :none
161
+ csharp_style_expression_bodied_operators = false :none
162
+
163
+ # Prefer property-like constructs to have an expression-body
164
+ csharp_style_expression_bodied_properties = false :none
165
+ csharp_style_expression_bodied_indexers = false :none
166
+ csharp_style_expression_bodied_accessors = false :none
167
+
168
+ # Suggest more modern language features when available
169
+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
170
+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
171
+ csharp_style_inlined_variable_declaration = true :suggestion
172
+ csharp_style_throw_expression = true :suggestion
173
+ csharp_style_conditional_delegate_call = true :suggestion
174
+
175
+ # Newline settings
176
+ csharp_new_line_before_open_brace = all
177
+ csharp_new_line_before_else = true
178
+ csharp_new_line_before_catch = true
179
+ csharp_new_line_before_finally = true
180
+ csharp_new_line_before_members_in_object_initializers = true
181
+ csharp_new_line_before_members_in_anonymous_types = true
182
+ csharp_new_line_between_query_expression_clauses = true
183
+
184
+ # Spacing
185
+ csharp_space_after_cast = false
186
+ csharp_space_after_colon_in_inheritance_clause = true
187
+ csharp_space_after_keywords_in_control_flow_statements = true
188
+ csharp_space_around_binary_operators = before_and_after
189
+ csharp_space_before_colon_in_inheritance_clause = true
190
+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
191
+ csharp_space_between_method_call_name_and_opening_parenthesis = false
192
+ csharp_space_between_method_call_parameter_list_parentheses = false
193
+ csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
194
+ csharp_space_between_method_declaration_parameter_list_parentheses = false
195
+ csharp_space_between_parentheses = false
196
+
197
+ # Blocks are allowed
198
+ csharp_prefer_braces = true :silent
199
+ csharp_preserve_single_line_blocks = true
200
+ csharp_preserve_single_line_statements = true
0 commit comments