1
1
# http://editorconfig.org
2
+
3
+ # top-most EditorConfig file
2
4
root = true
3
5
4
6
[* ]
@@ -11,3 +13,171 @@ insert_final_newline = true
11
13
12
14
[* .yml ]
13
15
indent_size = 2
16
+
17
+ # ## CSharp code style settings ###
18
+ [* .cs ]
19
+ # Organize usings
20
+ dotnet_separate_import_directive_groups = false
21
+ dotnet_sort_system_directives_first = true
22
+
23
+ # Avoid "this." and "Me." if not necessary
24
+ dotnet_style_qualification_for_field = false :silent
25
+ dotnet_style_qualification_for_property = false :silent
26
+ dotnet_style_qualification_for_method = false :silent
27
+ dotnet_style_qualification_for_event = false :silent
28
+
29
+ # Use language keywords instead of framework type names for type references
30
+ dotnet_style_predefined_type_for_locals_parameters_members = true :warning
31
+ dotnet_style_predefined_type_for_member_access = true :warning
32
+
33
+ # Parentheses preferences
34
+ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
35
+ dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
36
+ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
37
+ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
38
+
39
+ # Modifier preferences
40
+ dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
41
+
42
+ # Field preferences
43
+ dotnet_style_readonly_field = true :warning
44
+
45
+ # Parameter preferences
46
+ dotnet_code_quality_unused_parameters = all:warning
47
+
48
+ # Expression-level preferences
49
+ dotnet_style_coalesce_expression = true :suggestion
50
+ dotnet_style_collection_initializer = true :suggestion
51
+ dotnet_style_explicit_tuple_names = true :suggestion
52
+ dotnet_style_null_propagation = true :suggestion
53
+ dotnet_style_object_initializer = true :suggestion
54
+ dotnet_style_prefer_auto_properties = true :silent
55
+ dotnet_style_prefer_compound_assignment = true :warning
56
+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
57
+ dotnet_style_prefer_conditional_expression_over_return = true :silent
58
+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
59
+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
60
+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :warning
61
+ dotnet_style_prefer_simplified_interpolation = true :suggestion
62
+
63
+ # Dispose rules (CA2000 and CA2213) ported to IDE analyzers. We already execute the CA rules on the repo, so disable the IDE ones.
64
+ dotnet_diagnostic.IDE0067.severity = none
65
+ dotnet_diagnostic.IDE0068.severity = none
66
+ dotnet_diagnostic.IDE0069.severity = none
67
+
68
+ # ### C# Coding Conventions ####
69
+
70
+ # Prefer "var" everywhere
71
+ csharp_style_var_for_built_in_types = true :silent
72
+ csharp_style_var_when_type_is_apparent = true :silent
73
+ csharp_style_var_elsewhere = true :silent
74
+
75
+ # Prefer method-like constructs to have a block body, except for lambdas
76
+ csharp_style_expression_bodied_methods = true :warning
77
+ csharp_style_expression_bodied_constructors = true :warning
78
+ csharp_style_expression_bodied_operators = true :warning
79
+ csharp_style_expression_bodied_local_functions = true :warning
80
+ csharp_style_expression_bodied_lambdas = true :warning
81
+ csharp_style_expression_bodied_properties = true :warning
82
+ csharp_style_expression_bodied_accessors = true :warning
83
+ csharp_style_expression_bodied_indexers = true :warning
84
+
85
+ # Pattern matching preferences
86
+ csharp_style_pattern_matching_over_as_with_null_check = true :warning
87
+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
88
+ csharp_style_prefer_switch_expression = true :suggestion
89
+
90
+ # Null-checking preferences
91
+ csharp_style_conditional_delegate_call = true :warning
92
+
93
+ # Modifier preferences
94
+ csharp_prefer_static_local_function = true :warning
95
+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
96
+
97
+ # Code-block preferences
98
+ csharp_prefer_braces = when_multiline:none
99
+ csharp_prefer_simple_using_statement = true :warning
100
+
101
+ # Expression-level preferences
102
+ csharp_style_unused_value_assignment_preference = discard_variable:warning
103
+ csharp_prefer_simple_default_expression = true :suggestion
104
+ csharp_style_deconstructed_variable_declaration = true :suggestion
105
+ csharp_style_inlined_variable_declaration = true :suggestion
106
+ csharp_style_pattern_local_over_anonymous_function = true :suggestion
107
+ csharp_style_prefer_index_operator = true :suggestion
108
+ csharp_style_prefer_range_operator = true :suggestion
109
+ csharp_style_throw_expression = true :suggestion
110
+ csharp_style_unused_value_expression_statement_preference = discard_variable:silent
111
+
112
+ # 'using' directive preferences
113
+ csharp_using_directive_placement = outside_namespace:silent
114
+
115
+ # ### C# Formatting Rules ####
116
+
117
+ # New line preferences
118
+ csharp_new_line_before_open_brace = all
119
+ csharp_new_line_before_else = true
120
+ csharp_new_line_before_catch = true
121
+ csharp_new_line_before_finally = true
122
+ csharp_new_line_before_members_in_object_initializers = true
123
+ csharp_new_line_before_members_in_anonymous_types = true
124
+ csharp_new_line_between_query_expression_clauses = true
125
+
126
+ # Indentation preferences
127
+ csharp_indent_block_contents = true
128
+ csharp_indent_braces = false
129
+ csharp_indent_case_contents = true
130
+ csharp_indent_case_contents_when_block = true
131
+ csharp_indent_labels = no_change
132
+ csharp_indent_switch_labels = true
133
+
134
+ # Space preferences
135
+ csharp_space_after_cast = false
136
+ csharp_space_after_colon_in_inheritance_clause = true
137
+ csharp_space_after_comma = true
138
+ csharp_space_after_dot = false
139
+ csharp_space_after_keywords_in_control_flow_statements = true
140
+ csharp_space_after_semicolon_in_for_statement = true
141
+ csharp_space_around_binary_operators = before_and_after
142
+ csharp_space_around_declaration_statements = false
143
+ csharp_space_before_colon_in_inheritance_clause = true
144
+ csharp_space_before_comma = false
145
+ csharp_space_before_dot = false
146
+ csharp_space_before_open_square_brackets = false
147
+ csharp_space_before_semicolon_in_for_statement = false
148
+ csharp_space_between_empty_square_brackets = false
149
+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
150
+ csharp_space_between_method_call_name_and_opening_parenthesis = false
151
+ csharp_space_between_method_call_parameter_list_parentheses = false
152
+ csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
153
+ csharp_space_between_method_declaration_name_and_open_parenthesis = false
154
+ csharp_space_between_method_declaration_parameter_list_parentheses = false
155
+ csharp_space_between_parentheses = false
156
+ csharp_space_between_square_brackets = false
157
+
158
+ # IDE0011: Add braces
159
+ dotnet_diagnostic.IDE0011.severity = none
160
+
161
+ # IDE0090: Use 'new(...)'
162
+ dotnet_diagnostic.IDE0090.severity = warning
163
+
164
+ # IDE0041: Use 'is null' check
165
+ dotnet_diagnostic.IDE0041.severity = warning
166
+
167
+ # CA1825: Avoid zero-length array allocations
168
+ dotnet_diagnostic.CA1825.severity = warning
169
+
170
+ # CA1822: Mark members as static
171
+ dotnet_diagnostic.CA1822.severity = warning
172
+
173
+ # CA2208: Instantiate argument exceptions correctly
174
+ dotnet_diagnostic.CA2208.severity = warning
175
+
176
+ # CA1810: Initialize reference type static fields inline
177
+ dotnet_diagnostic.CA1810.severity = warning
178
+
179
+ # CA1816: Dispose methods should call SuppressFinalize
180
+ dotnet_diagnostic.CA1816.severity = warning
181
+
182
+ # IDE0005: Using directive is unnecessary.
183
+ dotnet_diagnostic.IDE0005.severity = warning
0 commit comments