main
text 251 lines 10.3 KB
Raw
1 # Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3 root = true
4
5 [*]
6 charset = utf-8
7
8 # Indentation and spacing
9 indent_size = 4
10 indent_style = space
11 tab_width = 4
12 trim_trailing_whitespace = true
13
14 # New line preferences
15 end_of_line = crlf
16 insert_final_newline = true
17
18 # C# files
19 [*.cs]
20
21 #### .NET Coding Conventions ####
22
23 # Organize usings
24 dotnet_separate_import_directive_groups = false
25 dotnet_sort_system_directives_first = true
26 file_header_template = Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
27
28 # Language keywords vs BCL types preferences
29 dotnet_style_predefined_type_for_locals_parameters_members = true:error
30 dotnet_style_predefined_type_for_member_access = false:error
31
32 # Parentheses preferences
33 dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
34 dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
35 dotnet_style_parentheses_in_other_operators = never_if_unnecessary
36 dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
37
38 # Modifier preferences
39 dotnet_style_require_accessibility_modifiers = for_non_interface_members
40
41 # Expression-level preferences
42 dotnet_style_coalesce_expression = true:warning
43 dotnet_style_collection_initializer = true
44 dotnet_style_explicit_tuple_names = true
45 dotnet_style_namespace_match_folder = true
46 dotnet_style_null_propagation = true:warning
47 dotnet_style_object_initializer = true
48 dotnet_style_operator_placement_when_wrapping = beginning_of_line
49 dotnet_style_prefer_auto_properties = true:error
50 dotnet_style_prefer_compound_assignment = true
51 dotnet_style_prefer_conditional_expression_over_assignment = true
52 dotnet_style_prefer_conditional_expression_over_return = true
53 dotnet_style_prefer_inferred_anonymous_type_member_names = true
54 dotnet_style_prefer_inferred_tuple_names = true
55 dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
56 dotnet_style_prefer_simplified_boolean_expressions = true
57 dotnet_style_prefer_simplified_interpolation = true
58
59 # Field preferences
60 dotnet_style_readonly_field = true:error
61
62 # Parameter preferences
63 dotnet_code_quality_unused_parameters = non_public:warning
64
65 # Suppression preferences
66 dotnet_remove_unnecessary_suppression_exclusions = none
67
68 # New line preferences
69 dotnet_style_allow_multiple_blank_lines_experimental = true
70 dotnet_style_allow_statement_immediately_after_block_experimental = true:suggestion
71
72 #### C# Coding Conventions ####
73
74 # var preferences
75 csharp_style_var_elsewhere = true:suggestion
76 csharp_style_var_for_built_in_types = true:suggestion
77 csharp_style_var_when_type_is_apparent = true:suggestion
78
79 # Expression-bodied members
80 csharp_style_expression_bodied_accessors =when_on_single_line:silent
81 csharp_style_expression_bodied_constructors = false:error
82 csharp_style_expression_bodied_indexers =when_on_single_line:silent
83 csharp_style_expression_bodied_lambdas = true
84 csharp_style_expression_bodied_local_functions = false:error
85 csharp_style_expression_bodied_methods =false:error
86 csharp_style_expression_bodied_operators =false:error
87 csharp_style_expression_bodied_properties =when_on_single_line:silent
88
89 # Pattern matching preferences
90 csharp_style_pattern_matching_over_as_with_null_check = true:error
91 csharp_style_pattern_matching_over_is_with_cast_check = true:error
92 csharp_style_prefer_not_pattern = true:warning
93 csharp_style_prefer_pattern_matching = true
94 csharp_style_prefer_switch_expression = true
95
96 # Null-checking preferences
97 csharp_style_conditional_delegate_call = true:warning
98
99 # Modifier preferences
100 csharp_prefer_static_local_function = true:error
101 csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
102
103 # Code-block preferences
104 csharp_prefer_braces = true:error
105 csharp_prefer_simple_using_statement = false
106
107 # Expression-level preferences
108 csharp_prefer_simple_default_expression = true
109 csharp_style_deconstructed_variable_declaration =true:silent
110 csharp_style_implicit_object_creation_when_type_is_apparent = true
111 csharp_style_inlined_variable_declaration = true:warning
112 csharp_style_pattern_local_over_anonymous_function = true
113 csharp_style_prefer_index_operator = true
114 csharp_style_prefer_range_operator =true:silent
115 csharp_style_throw_expression = true
116 csharp_style_unused_value_assignment_preference = discard_variable:error
117 csharp_style_unused_value_expression_statement_preference = discard_variable
118
119 # 'using' directive preferences
120 csharp_using_directive_placement = inside_namespace:error
121
122 # New line preferences
123 csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
124 csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning
125 csharp_style_allow_embedded_statements_on_same_line_experimental = true
126
127 #### C# Formatting Rules ####
128
129 # New line preferences
130 csharp_new_line_before_catch = true
131 csharp_new_line_before_else = true
132 csharp_new_line_before_finally = true
133 csharp_new_line_before_members_in_anonymous_types = true
134 csharp_new_line_before_members_in_object_initializers = true
135 csharp_new_line_before_open_brace = all
136 csharp_new_line_between_query_expression_clauses = true
137
138 # Indentation preferences
139 csharp_indent_block_contents = true
140 csharp_indent_braces = false
141 csharp_indent_case_contents = true
142 csharp_indent_case_contents_when_block =false
143 csharp_indent_labels = one_less_than_current
144 csharp_indent_switch_labels =true
145
146 # Space preferences
147 csharp_space_after_cast = false
148 csharp_space_after_colon_in_inheritance_clause = true
149 csharp_space_after_comma = true
150 csharp_space_after_dot = false
151 csharp_space_after_keywords_in_control_flow_statements = true
152 csharp_space_after_semicolon_in_for_statement = true
153 csharp_space_around_binary_operators = before_and_after
154 csharp_space_around_declaration_statements = false
155 csharp_space_before_colon_in_inheritance_clause = true
156 csharp_space_before_comma = false
157 csharp_space_before_dot = false
158 csharp_space_before_open_square_brackets = false
159 csharp_space_before_semicolon_in_for_statement = false
160 csharp_space_between_empty_square_brackets = false
161 csharp_space_between_method_call_empty_parameter_list_parentheses = false
162 csharp_space_between_method_call_name_and_opening_parenthesis = false
163 csharp_space_between_method_call_parameter_list_parentheses = false
164 csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
165 csharp_space_between_method_declaration_name_and_open_parenthesis = false
166 csharp_space_between_method_declaration_parameter_list_parentheses = false
167 csharp_space_between_parentheses = false
168 csharp_space_between_square_brackets = false
169
170 # Wrapping preferences
171 csharp_preserve_single_line_blocks = true
172 csharp_preserve_single_line_statements = true
173
174 #### Naming styles ####
175
176 # Naming rules
177
178 dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
179 dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
180 dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
181
182 dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
183 dotnet_naming_rule.types_should_be_pascal_case.symbols = types
184 dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
185
186 dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
187 dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
188 dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
189
190 dotnet_naming_rule.const_field_members_should_be_pascal_case.severity = suggestion
191 dotnet_naming_rule.const_field_members_should_be_pascal_case.symbols = const_fields
192 dotnet_naming_rule.const_field_members_should_be_pascal_case.style = pascal_case
193
194 dotnet_naming_rule.const_field_members_should_be_pascal_case.severity = suggestion
195 dotnet_naming_rule.const_field_members_should_be_pascal_case.symbols = static_fields
196 dotnet_naming_rule.const_field_members_should_be_pascal_case.style = pascal_case
197
198 # dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
199 # dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
200 # dotnet_naming_rule.private_members_with_underscore.severity = suggestion
201
202 # Symbol specifications
203
204 dotnet_naming_symbols.interface.applicable_kinds = interface
205 dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
206 dotnet_naming_symbols.interface.required_modifiers =
207
208 dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
209 dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
210 dotnet_naming_symbols.types.required_modifiers =
211
212 dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
213 dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
214 dotnet_naming_symbols.non_field_members.required_modifiers =
215
216 dotnet_naming_symbols.private_fields.applicable_kinds = field
217 dotnet_naming_symbols.private_fields.applicable_accessibilities = private
218
219 dotnet_naming_symbols.const_fields.applicable_kinds = field
220 dotnet_naming_symbols.const_fields.required_modifiers = const
221
222 dotnet_naming_symbols.static_fields.applicable_kinds = field
223 dotnet_naming_symbols.static_fields.required_modifiers = static
224
225 # Naming styles
226
227 dotnet_naming_style.pascal_case.required_prefix =
228 dotnet_naming_style.pascal_case.required_suffix =
229 dotnet_naming_style.pascal_case.word_separator =
230 dotnet_naming_style.pascal_case.capitalization = pascal_case
231
232 dotnet_naming_style.begins_with_i.required_prefix = I
233 dotnet_naming_style.begins_with_i.required_suffix =
234 dotnet_naming_style.begins_with_i.word_separator =
235 dotnet_naming_style.begins_with_i.capitalization = pascal_case
236
237 dotnet_naming_style.prefix_underscore.capitalization = camel_case
238 dotnet_naming_style.prefix_underscore.required_prefix = _
239
240
241 [*.{cs,vb}]
242
243 # this. and Me. preferences
244 dotnet_style_qualification_for_event = true:error
245 dotnet_style_qualification_for_field = true:error
246 dotnet_style_qualification_for_method = true:error
247 dotnet_style_qualification_for_property = true:error
248
249
250 [*.{props,targets,csproj,wixproj,vcxproj}]
251 indent_size = 2