1- # EditorConfig is awesome:http://EditorConfig .org
1+ # editorconfig .org
22
33# top-most EditorConfig file
44root = true
55
6- # Don't use tabs for indentation.
6+ # Default settings:
7+ # A newline ending every file
8+ # Use tab for spaces
79[* ]
10+ insert_final_newline = true
811indent_style = tab
9- guidelines = 80 , 120 , 160
10- # (Please don't specify an indent_size here; that has too many unintended consequences.)
11-
12- # Code files
13- [* .{cs,csx,vb,vbx} ]
14- indent_size = 2
15-
16- # Xml project files
17- [* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj} ]
1812indent_size = 2
13+ tab_width = 2
14+ trim_trailing_whitespace = true
15+ dotnet_style_operator_placement_when_wrapping = beginning_of_line
16+ end_of_line = crlf
17+ dotnet_style_coalesce_expression = true :suggestion
18+ dotnet_style_null_propagation = true :suggestion
19+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
20+ dotnet_style_prefer_auto_properties = true :suggestion
21+ dotnet_style_object_initializer = true :suggestion
22+ dotnet_style_prefer_collection_expression = true :suggestion
23+ dotnet_style_collection_initializer = true :suggestion
24+ dotnet_style_prefer_simplified_boolean_expressions = true :suggestion
25+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
26+ dotnet_style_prefer_conditional_expression_over_return = true :silent
27+ dotnet_style_explicit_tuple_names = true :suggestion
28+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
29+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
30+ dotnet_style_prefer_compound_assignment = true :suggestion
31+ dotnet_style_prefer_simplified_interpolation = true :suggestion
32+ dotnet_style_namespace_match_folder = true :suggestion
33+ dotnet_style_readonly_field = true :suggestion
34+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
35+ dotnet_style_predefined_type_for_member_access = true :suggestion
36+ dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
37+ dotnet_style_allow_multiple_blank_lines_experimental = true :silent
38+ dotnet_style_allow_statement_immediately_after_block_experimental = true :silent
39+ dotnet_code_quality_unused_parameters = all:suggestion
40+ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
41+ dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
42+ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
43+ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
44+ dotnet_style_qualification_for_field = false :suggestion
45+ dotnet_style_qualification_for_property = false :suggestion
46+ dotnet_style_qualification_for_method = false :suggestion
47+ dotnet_style_qualification_for_event = false :suggestion
1948
20- # Xml config files
21- [* .{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct} ]
22- indent_size = 2
49+ [project.json ]
2350
24- # JSON files
25- [* .json ]
26- indent_size = 2
51+ # Generated code
52+ [* {_AssemblyInfo.cs,.notsupported.cs} ]
53+ generated_code = true
2754
28- # YAML files
29- [* .yml ]
30- indent_style = space
31-
32- # Dotnet code style settings:
55+ # C# files
3356[* .cs ]
34- # Sort using and Import directives with System.* appearing first
35- dotnet_sort_system_directives_first = true
57+ # New line preferences
58+ csharp_new_line_before_open_brace = all
59+ csharp_new_line_before_else = true
60+ csharp_new_line_before_catch = true
61+ csharp_new_line_before_finally = true
62+ csharp_new_line_before_members_in_object_initializers = true
63+ csharp_new_line_before_members_in_anonymous_types = true
64+ csharp_new_line_between_query_expression_clauses = true
65+
66+ # Indentation preferences
67+ csharp_indent_block_contents = true
68+ csharp_indent_braces = false
69+ csharp_indent_case_contents = true
70+ csharp_indent_case_contents_when_block = true
71+ csharp_indent_switch_labels = true
72+ csharp_indent_labels = one_less_than_current
3673
37- # Specify validation methods
38- dotnet_code_quality.null_check_validation_methods = IsNotNull
74+ # Modifier preferences
75+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
3976
40- # Don't use this. qualifier
77+ # avoid this. unless absolutely necessary
4178dotnet_style_qualification_for_field = false :suggestion
4279dotnet_style_qualification_for_property = false :suggestion
80+ dotnet_style_qualification_for_method = false :suggestion
81+ dotnet_style_qualification_for_event = false :suggestion
4382
44- # use int x = .. over Int32
83+ # Types: use keywords instead of BCL types, and permit var only when the type is clear
84+ csharp_style_var_for_built_in_types = false :suggestion
85+ csharp_style_var_when_type_is_apparent = false :none
86+ csharp_style_var_elsewhere = false :suggestion
4587dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
46-
47- # use int.MaxValue over Int32.MaxValue
4888dotnet_style_predefined_type_for_member_access = true :suggestion
4989
50- # Require var all the time.
51- csharp_style_var_for_built_in_types = false :suggestion
52- csharp_style_var_when_type_is_apparent = true :suggestion
53- csharp_style_var_elsewhere = true :suggestion
54-
55- # Disallow throw expressions.
56- csharp_style_throw_expression = false :suggestion
57-
58- # Newline settings
59- csharp_new_line_before_open_brace = all
60- csharp_new_line_before_else = true
61- csharp_new_line_before_catch = true
62- csharp_new_line_before_finally = true
63- csharp_new_line_before_members_in_object_initializers = true
64- csharp_new_line_before_members_in_anonymous_types = true
90+ # name all constant fields using PascalCase
91+ dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
92+ dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
93+ dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
94+ dotnet_naming_symbols.constant_fields.applicable_kinds = field
95+ dotnet_naming_symbols.constant_fields.required_modifiers = const
96+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
97+
98+ # static fields should have s_ prefix
99+ dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
100+ dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
101+ dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
102+ dotnet_naming_symbols.static_fields.applicable_kinds = field
103+ dotnet_naming_symbols.static_fields.required_modifiers = static
104+ dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
105+ dotnet_naming_style.static_prefix_style.required_prefix = s_
106+ dotnet_naming_style.static_prefix_style.capitalization = camel_case
107+
108+ # internal and private fields should be _camelCase
109+ dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
110+ dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
111+ dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
112+ dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
113+ dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
114+ dotnet_naming_style.camel_case_underscore_style.required_prefix = _
115+ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
116+
117+ # Code style defaults
118+ csharp_using_directive_placement = outside_namespace:suggestion
119+ dotnet_sort_system_directives_first = true
120+ csharp_prefer_braces = true :silent
121+ csharp_preserve_single_line_blocks = true :none
122+ csharp_preserve_single_line_statements = false :none
123+ csharp_prefer_static_local_function = true :suggestion
124+ csharp_prefer_simple_using_statement = false :none
125+ csharp_style_prefer_switch_expression = true :suggestion
126+ dotnet_style_readonly_field = true :suggestion
127+
128+ # Expression-level preferences
129+ dotnet_style_object_initializer = true :suggestion
130+ dotnet_style_collection_initializer = true :suggestion
131+ dotnet_style_explicit_tuple_names = true :suggestion
132+ dotnet_style_coalesce_expression = true :suggestion
133+ dotnet_style_null_propagation = true :suggestion
134+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
135+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
136+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
137+ dotnet_style_prefer_auto_properties = true :suggestion
138+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
139+ dotnet_style_prefer_conditional_expression_over_return = true :silent
140+ csharp_prefer_simple_default_expression = true :suggestion
141+
142+ # Expression-bodied members
143+ csharp_style_expression_bodied_methods = true :silent
144+ csharp_style_expression_bodied_constructors = true :silent
145+ csharp_style_expression_bodied_operators = true :silent
146+ csharp_style_expression_bodied_properties = true :silent
147+ csharp_style_expression_bodied_indexers = true :silent
148+ csharp_style_expression_bodied_accessors = true :silent
149+ csharp_style_expression_bodied_lambdas = true :silent
150+ csharp_style_expression_bodied_local_functions = true :silent
151+
152+ # Pattern matching
153+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
154+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
155+ csharp_style_inlined_variable_declaration = true :suggestion
156+
157+ # Null checking preferences
158+ csharp_style_throw_expression = true :suggestion
159+ csharp_style_conditional_delegate_call = true :suggestion
160+
161+ # Other features
162+ csharp_style_prefer_index_operator = false :none
163+ csharp_style_prefer_range_operator = false :none
164+ csharp_style_pattern_local_over_anonymous_function = false :none
165+
166+ # Space preferences
167+ csharp_space_after_cast = false
168+ csharp_space_after_colon_in_inheritance_clause = true
169+ csharp_space_after_comma = true
170+ csharp_space_after_dot = false
171+ csharp_space_after_keywords_in_control_flow_statements = true
172+ csharp_space_after_semicolon_in_for_statement = true
173+ csharp_space_around_binary_operators = before_and_after
174+ csharp_space_around_declaration_statements = do_not_ignore
175+ csharp_space_before_colon_in_inheritance_clause = true
176+ csharp_space_before_comma = false
177+ csharp_space_before_dot = false
178+ csharp_space_before_open_square_brackets = false
179+ csharp_space_before_semicolon_in_for_statement = false
180+ csharp_space_between_empty_square_brackets = false
181+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
182+ csharp_space_between_method_call_name_and_opening_parenthesis = false
183+ csharp_space_between_method_call_parameter_list_parentheses = false
184+ csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
185+ csharp_space_between_method_declaration_name_and_open_parenthesis = false
186+ csharp_space_between_method_declaration_parameter_list_parentheses = false
187+ csharp_space_between_parentheses = false
188+ csharp_space_between_square_brackets = false
189+
190+ # License header
191+ file_header_template = This work is licensed under the terms of the MIT license.\nFor a copy, see <https://opensource.org/licenses/MIT>.
192+ csharp_style_namespace_declarations = file_scoped:silent
193+ csharp_style_prefer_method_group_conversion = true :silent
194+ csharp_style_prefer_top_level_statements = true :silent
195+ csharp_style_prefer_primary_constructors = true :suggestion
196+ csharp_style_prefer_null_check_over_type_check = true :suggestion
197+ csharp_style_prefer_local_over_anonymous_function = true :suggestion
198+ csharp_style_implicit_object_creation_when_type_is_apparent = true :suggestion
199+ csharp_style_prefer_tuple_swap = true :suggestion
200+ csharp_style_prefer_utf8_string_literals = true :suggestion
201+ csharp_style_deconstructed_variable_declaration = true :suggestion
202+ csharp_style_unused_value_assignment_preference = discard_variable:suggestion
203+ csharp_style_unused_value_expression_statement_preference = discard_variable:silent
204+ csharp_style_prefer_readonly_struct = true :suggestion
205+ csharp_style_prefer_readonly_struct_member = true :suggestion
206+ csharp_style_allow_embedded_statements_on_same_line_experimental = true :silent
207+ csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true :silent
208+ csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true :silent
209+ csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true :silent
210+ csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true :silent
211+ csharp_style_prefer_pattern_matching = true :silent
212+ csharp_style_prefer_not_pattern = true :suggestion
213+ csharp_style_prefer_extended_property_pattern = true :suggestion
214+
215+ # C++ Files
216+ [* .{cpp,h,in} ]
217+ curly_bracket_next_line = true
218+ indent_brace_style = Allman
219+
220+ [* .{csproj,vbproj,proj,nativeproj,locproj} ]
221+ charset = utf-8
222+
223+ # YAML config files
224+ [* .{yml,yaml} ]
225+ indent_style = space
226+ indent_size = 2
65227
66- # CA1707: Identifiers should not contain underscores
67- dotnet_diagnostic.CA1707.severity = silent
228+ # Shell scripts
229+ [* .sh ]
230+ end_of_line = lf
231+ [* .{cmd,bat} ]
232+ end_of_line = crlf
0 commit comments