1+ # top-most EditorConfig file
2+ root = true
3+
4+ # Default settings:
5+ # A newline ending every file
6+ # Use 4 spaces as indentation
7+ [* ]
8+ insert_final_newline = true
9+ indent_style = space
10+ indent_size = 4
11+ trim_trailing_whitespace = true
12+ dotnet_style_require_accessibility_modifiers =for_non_interface_members:warning
13+
14+ [project.json ]
15+ indent_size = 2
16+
17+ # Generated code
18+ [* {_AssemblyInfo.cs,.notsupported.cs} ]
19+ generated_code = true
20+
21+ # C# files
22+ [* .cs ]
23+ # New line preferences
24+ csharp_new_line_before_open_brace = all
25+ csharp_new_line_before_else = true
26+ csharp_new_line_before_catch = true
27+ csharp_new_line_before_finally = true
28+ csharp_new_line_before_members_in_object_initializers = true
29+ csharp_new_line_before_members_in_anonymous_types = true
30+ csharp_new_line_between_query_expression_clauses = true
31+
32+ # Indentation preferences
33+ csharp_indent_block_contents = true
34+ csharp_indent_braces = false
35+ csharp_indent_case_contents = true
36+ csharp_indent_case_contents_when_block = true
37+ csharp_indent_switch_labels = true
38+ csharp_indent_labels = one_less_than_current
39+
40+ # Modifier preferences
41+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
42+
43+ # avoid this. unless absolutely necessary
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
48+
49+ # Types: use keywords instead of BCL types, and permit var only when the type is clear
50+ csharp_style_var_for_built_in_types = false :suggestion
51+ csharp_style_var_when_type_is_apparent = false :none
52+ csharp_style_var_elsewhere = false :suggestion
53+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
54+ dotnet_style_predefined_type_for_member_access = true :suggestion
55+
56+ # name all constant fields using PascalCase
57+ dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
58+ dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
59+ dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
60+ dotnet_naming_symbols.constant_fields.applicable_kinds = field
61+ dotnet_naming_symbols.constant_fields.required_modifiers = const
62+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
63+
64+ # static fields should have s_ prefix
65+ dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
66+ dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
67+ dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
68+ dotnet_naming_symbols.static_fields.applicable_kinds = field
69+ dotnet_naming_symbols.static_fields.required_modifiers = static
70+ dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
71+ dotnet_naming_style.static_prefix_style.required_prefix = s_
72+ dotnet_naming_style.static_prefix_style.capitalization = camel_case
73+
74+ # internal and private fields should be _camelCase
75+ dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
76+ dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
77+ dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
78+ dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
79+ dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
80+ dotnet_naming_style.camel_case_underscore_style.required_prefix = _
81+ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
82+
83+ # Code style defaults
84+ csharp_using_directive_placement = outside_namespace:suggestion
85+ dotnet_sort_system_directives_first = true
86+ csharp_prefer_braces = true :silent
87+ csharp_preserve_single_line_blocks = true :none
88+ csharp_preserve_single_line_statements = false :none
89+ csharp_prefer_static_local_function = true :suggestion
90+ csharp_prefer_simple_using_statement = false :none
91+ csharp_style_prefer_switch_expression = true :suggestion
92+
93+ # Code quality
94+ dotnet_style_readonly_field = true :suggestion
95+ dotnet_code_quality_unused_parameters = non_public:suggestion
96+
97+ # Expression-level preferences
98+ dotnet_style_object_initializer = true :suggestion
99+ dotnet_style_collection_initializer = true :suggestion
100+ dotnet_style_explicit_tuple_names = true :suggestion
101+ dotnet_style_coalesce_expression = true :suggestion
102+ dotnet_style_null_propagation = true :suggestion
103+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
104+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
105+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
106+ dotnet_style_prefer_auto_properties = true :suggestion
107+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
108+ dotnet_style_prefer_conditional_expression_over_return = true :silent
109+ csharp_prefer_simple_default_expression = true :suggestion
110+
111+ # Expression-bodied members
112+ csharp_style_expression_bodied_methods = true :silent
113+ csharp_style_expression_bodied_constructors = true :silent
114+ csharp_style_expression_bodied_operators = true :silent
115+ csharp_style_expression_bodied_properties = true :silent
116+ csharp_style_expression_bodied_indexers = true :silent
117+ csharp_style_expression_bodied_accessors = true :silent
118+ csharp_style_expression_bodied_lambdas = true :silent
119+ csharp_style_expression_bodied_local_functions = true :silent
120+
121+ # Pattern matching
122+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
123+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
124+ csharp_style_inlined_variable_declaration = true :suggestion
125+
126+ # Null checking preferences
127+ csharp_style_throw_expression = true :suggestion
128+ csharp_style_conditional_delegate_call = true :suggestion
129+
130+ # Other features
131+ csharp_style_prefer_index_operator = false :none
132+ csharp_style_prefer_range_operator = false :none
133+ csharp_style_pattern_local_over_anonymous_function = false :none
134+
135+ # Space preferences
136+ csharp_space_after_cast = false
137+ csharp_space_after_colon_in_inheritance_clause = true
138+ csharp_space_after_comma = true
139+ csharp_space_after_dot = false
140+ csharp_space_after_keywords_in_control_flow_statements = true
141+ csharp_space_after_semicolon_in_for_statement = true
142+ csharp_space_around_binary_operators = before_and_after
143+ csharp_space_around_declaration_statements = do_not_ignore
144+ csharp_space_before_colon_in_inheritance_clause = true
145+ csharp_space_before_comma = false
146+ csharp_space_before_dot = false
147+ csharp_space_before_open_square_brackets = false
148+ csharp_space_before_semicolon_in_for_statement = false
149+ csharp_space_between_empty_square_brackets = false
150+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
151+ csharp_space_between_method_call_name_and_opening_parenthesis = false
152+ csharp_space_between_method_call_parameter_list_parentheses = false
153+ csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
154+ csharp_space_between_method_declaration_name_and_open_parenthesis = false
155+ csharp_space_between_method_declaration_parameter_list_parentheses = false
156+ csharp_space_between_parentheses = false
157+ csharp_space_between_square_brackets = false
158+
159+ # Analyzers
160+ dotnet_code_quality.ca1802.api_surface = private, internal
161+ dotnet_code_quality.ca1822.api_surface = private, internal
162+ dotnet_code_quality.ca2208.api_surface = public
163+
164+ # License header
165+ file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.
166+
167+ # C++ Files
168+ [* .{cpp,h,in} ]
169+ curly_bracket_next_line = true
170+ indent_brace_style = Allman
171+
172+ # Xml project files
173+ [* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj} ]
174+ indent_size = 2
175+
176+ [* .{csproj,vbproj,proj,nativeproj,locproj} ]
177+ charset = utf-8
178+
179+ # Xml build files
180+ [* .builds ]
181+ indent_size = 2
182+
183+ # Xml files
184+ [* .{xml,stylecop,resx,ruleset} ]
185+ indent_size = 2
186+
187+ # Xml config files
188+ [* .{props,targets,config,nuspec} ]
189+ indent_size = 2
190+
191+ # YAML config files
192+ [* .{yml,yaml} ]
193+ indent_size = 2
194+
195+ # Shell scripts
196+ [* .sh ]
197+ end_of_line = lf
198+ [* .{cmd,bat} ]
199+ end_of_line = crlf
0 commit comments