Skip to content

Commit 5be3f31

Browse files
committed
Add more defaults to .editorconfig to better match coding style
1 parent ac7f780 commit 5be3f31

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

.editorconfig

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ root = true
55
indent_style = tab
66
indent_size = 4
77
guidelines = 110
8+
tab_width = 4
9+
end_of_line = crlf
810

911
[*.il]
1012
indent_style = space
@@ -44,7 +46,7 @@ csharp_indent_braces = false
4446
csharp_indent_case_contents = true
4547
csharp_indent_case_contents_when_block = false
4648
csharp_indent_switch_labels = true
47-
csharp_indent_labels = one_less
49+
csharp_indent_labels = no_change
4850

4951
# Avoid 'this.' in generated code unless absolutely necessary, but allow developers to use it
5052
dotnet_style_qualification_for_field = false:silent
@@ -54,7 +56,7 @@ dotnet_style_qualification_for_event = false:silent
5456

5557
# Do not use 'var' when generating code, but allow developers to use it
5658
csharp_style_var_for_built_in_types = false:silent
57-
csharp_style_var_when_type_is_apparent = false:silent
59+
csharp_style_var_when_type_is_apparent = true:suggestion
5860
csharp_style_var_elsewhere = false:silent
5961

6062
# Use language keywords instead of BCL types when generating code, but allow developers to use either
@@ -143,6 +145,72 @@ dotnet_naming_rule.private_fields_rule.severity = warning
143145
dotnet_naming_rule.private_fields_rule.style = lower_camel_case_style
144146
dotnet_naming_rule.private_fields_rule.symbols = private_fields_symbols
145147

148+
# General settings:
149+
csharp_using_directive_placement = outside_namespace:silent
150+
csharp_prefer_simple_using_statement = true:suggestion
151+
csharp_style_namespace_declarations = block_scoped:silent
152+
csharp_style_prefer_method_group_conversion = true:silent
153+
csharp_style_prefer_top_level_statements = true:silent
154+
csharp_style_prefer_primary_constructors = true:suggestion
155+
csharp_prefer_system_threading_lock = true:suggestion
156+
csharp_style_expression_bodied_lambdas = true:silent
157+
csharp_style_expression_bodied_local_functions = false:silent
158+
csharp_style_prefer_null_check_over_type_check = true:suggestion
159+
csharp_prefer_simple_default_expression = true:suggestion
160+
csharp_style_prefer_local_over_anonymous_function = true:suggestion
161+
csharp_style_prefer_index_operator = true:suggestion
162+
csharp_style_prefer_range_operator = true:suggestion
163+
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
164+
csharp_style_prefer_tuple_swap = true:suggestion
165+
csharp_style_prefer_utf8_string_literals = true:suggestion
166+
csharp_style_deconstructed_variable_declaration = true:suggestion
167+
csharp_prefer_static_local_function = true:suggestion
168+
csharp_prefer_static_anonymous_function = true:suggestion
169+
csharp_style_prefer_readonly_struct = true:suggestion
170+
csharp_style_prefer_readonly_struct_member = true:suggestion
171+
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
172+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
173+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
174+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
175+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
176+
csharp_style_prefer_switch_expression = true:suggestion
177+
csharp_style_prefer_pattern_matching = true:silent
178+
csharp_style_prefer_not_pattern = true:suggestion
179+
csharp_style_prefer_extended_property_pattern = true:suggestion
180+
181+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
182+
dotnet_style_coalesce_expression = true:suggestion
183+
dotnet_style_null_propagation = true:suggestion
184+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
185+
dotnet_style_prefer_auto_properties = true:silent
186+
dotnet_style_object_initializer = true:suggestion
187+
dotnet_style_collection_initializer = true:suggestion
188+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
189+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
190+
dotnet_style_prefer_conditional_expression_over_return = true:silent
191+
dotnet_style_explicit_tuple_names = true:suggestion
192+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
193+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
194+
dotnet_style_prefer_compound_assignment = true:suggestion
195+
dotnet_style_prefer_simplified_interpolation = true:suggestion
196+
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
197+
dotnet_style_namespace_match_folder = true:suggestion
198+
dotnet_style_readonly_field = true:suggestion
199+
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
200+
dotnet_style_predefined_type_for_member_access = true:silent
201+
dotnet_style_require_accessibility_modifiers = omit_if_default:suggestion
202+
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
203+
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
204+
dotnet_code_quality_unused_parameters = all:suggestion
205+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
206+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
207+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
208+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
209+
dotnet_style_qualification_for_field = false:silent
210+
dotnet_style_qualification_for_property = false:silent
211+
dotnet_style_qualification_for_method = false:silent
212+
dotnet_style_qualification_for_event = false:silent
213+
146214
# Errors and warnings
147215

148216
# MEF006: No importing constructor

Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<WarningsAsErrors>IDE2000</WarningsAsErrors>
4+
</PropertyGroup>
5+
</Project>

ILSpy.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ EndProject
3939
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D0858E90-DCD5-4FD9-AA53-7262FAB8BEDB}"
4040
ProjectSection(SolutionItems) = preProject
4141
.editorconfig = .editorconfig
42+
Directory.Build.props = Directory.Build.props
4243
Directory.Packages.props = Directory.Packages.props
4344
EndProjectSection
4445
EndProject

0 commit comments

Comments
 (0)