1+ # EditorConfig file
12root = true
23
4+ # General settings for all files
35[* ]
4- end_of_line = crlf
5- insert_final_newline = true
6- indent_style = tab
6+ indent_style = space
7+ spelling_exclusion_path = SpellingExclusions.dic
8+
9+ # Code files
10+ [* .{cs,csx,vb,vbx} ]
711indent_size = 4
12+ insert_final_newline = true
13+ charset = utf-8
14+
15+ # XML project files
16+ [* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj} ]
17+ indent_size = 2
18+
19+ # XML config files
20+ [* .{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct} ]
21+ indent_size = 2
22+
23+ # JSON files
24+ [* .json ]
25+ indent_size = 2
26+
27+ # PowerShell files
28+ [* .ps1 ]
29+ indent_size = 2
30+
31+ # Shell scripts
32+ [* .sh ]
33+ end_of_line = lf
34+ indent_size = 2
35+
36+ # #########################################
37+ # C# and VB.NET style settings
38+ [* .{cs,vb} ]
39+ # #########################################
40+
41+ dotnet_sort_system_directives_first = true
42+ dotnet_separate_import_directive_groups = false
43+ dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
44+
45+ # Qualification
46+ dotnet_style_qualification_for_field = false:refactoring
47+ dotnet_style_qualification_for_property = false:refactoring
48+ dotnet_style_qualification_for_method = false:refactoring
49+ dotnet_style_qualification_for_event = false:refactoring
50+
51+ # Predefined type preference
52+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
53+ dotnet_style_predefined_type_for_member_access = true :suggestion
54+
55+ # Modern language features
56+ dotnet_style_object_initializer = true :suggestion
57+ dotnet_style_collection_initializer = true :suggestion
58+ dotnet_style_coalesce_expression = true :suggestion
59+ dotnet_style_null_propagation = true :suggestion
60+ dotnet_style_explicit_tuple_names = true :suggestion
61+
62+ # Whitespace
63+ dotnet_style_allow_multiple_blank_lines_experimental = false
64+
65+ # API analyzer
66+ dotnet_public_api_analyzer.require_api_files = true
67+
68+ # IDE0055 formatting fix
69+ dotnet_diagnostic.IDE0055.severity = warning
70+
71+ # #########################################
72+ # Naming Rules
73+ # #########################################
74+
75+ # Naming errors as warning
76+ dotnet_diagnostic.IDE1006.severity = warning
77+
78+ # === Naming Styles ===
79+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
80+
81+ dotnet_naming_style.camel_case_style.capitalization = camel_case
82+
83+ dotnet_naming_style.underscore_camel_case_style.capitalization = camel_case
84+ dotnet_naming_style.underscore_camel_case_style.required_prefix = _
85+
86+ dotnet_naming_style.interface_style.capitalization = pascal_case
87+ dotnet_naming_style.interface_style.required_prefix = I
88+
89+ dotnet_naming_style.async_method_style.capitalization = pascal_case
90+ dotnet_naming_style.async_method_style.required_suffix = Async
91+
92+ # === Symbols ===
93+ dotnet_naming_symbols.public_api_symbols.applicable_kinds = class, struct, enum, property, method, event, field, delegate, namespace
94+ dotnet_naming_symbols.public_api_symbols.applicable_accessibilities = public, protected, protected_internal
95+
96+ dotnet_naming_symbols.private_fields.applicable_kinds = field
97+ dotnet_naming_symbols.private_fields.applicable_accessibilities = private
98+
99+ dotnet_naming_symbols.locals_and_parameters.applicable_kinds = local, parameter
100+ dotnet_naming_symbols.locals_and_parameters.applicable_accessibilities = *
101+
102+ dotnet_naming_symbols.constants.applicable_kinds = field
103+ dotnet_naming_symbols.constants.required_modifiers = const
104+
105+ dotnet_naming_symbols.interfaces.applicable_kinds = interface
106+ dotnet_naming_symbols.interfaces.applicable_accessibilities = *
107+
108+ dotnet_naming_symbols.async_methods.applicable_kinds = method
109+ dotnet_naming_symbols.async_methods.required_modifiers = async
110+
111+ # === Rules ===
112+ dotnet_naming_rule.public_api_should_be_pascal_case.symbols = public_api_symbols
113+ dotnet_naming_rule.public_api_should_be_pascal_case.style = pascal_case_style
114+ dotnet_naming_rule.public_api_should_be_pascal_case.severity = warning
115+
116+ dotnet_naming_rule.private_fields_should_be_underscore_camel.symbols = private_fields
117+ dotnet_naming_rule.private_fields_should_be_underscore_camel.style = underscore_camel_case_style
118+ dotnet_naming_rule.private_fields_should_be_underscore_camel.severity = warning
119+
120+ dotnet_naming_rule.locals_and_parameters_should_be_camel_case.symbols = locals_and_parameters
121+ dotnet_naming_rule.locals_and_parameters_should_be_camel_case.style = camel_case_style
122+ dotnet_naming_rule.locals_and_parameters_should_be_camel_case.severity = warning
123+
124+ dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
125+ dotnet_naming_rule.constants_should_be_pascal_case.style = pascal_case_style
126+ dotnet_naming_rule.constants_should_be_pascal_case.severity = warning
127+
128+ dotnet_naming_rule.interfaces_should_be_prefixed_with_i.symbols = interfaces
129+ dotnet_naming_rule.interfaces_should_be_prefixed_with_i.style = interface_style
130+ dotnet_naming_rule.interfaces_should_be_prefixed_with_i.severity = warning
131+
132+ dotnet_naming_rule.async_methods_should_end_with_async.symbols = async_methods
133+ dotnet_naming_rule.async_methods_should_end_with_async.style = async_method_style
134+ dotnet_naming_rule.async_methods_should_end_with_async.severity = warning
135+
136+ # Other style settings
137+ dotnet_style_operator_placement_when_wrapping = beginning_of_line
138+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :warning
139+ dotnet_style_prefer_auto_properties = true :silent
140+ dotnet_style_prefer_simplified_boolean_expressions = true :suggestion
141+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
142+ dotnet_style_prefer_conditional_expression_over_return = true :silent
143+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
144+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
145+ dotnet_style_prefer_compound_assignment = true :suggestion
146+ dotnet_style_prefer_simplified_interpolation = true :suggestion
147+ dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
148+
149+ # #########################################
150+ # C# Specific settings
151+ [* .cs ]
152+ # #########################################
153+
154+ # Namespaces
155+ csharp_style_namespace_declarations = file_scoped:warning # Less indentation
156+
157+ # Newlines
158+ csharp_new_line_before_open_brace = all
159+ csharp_new_line_before_else = true
160+ csharp_new_line_before_catch = true
161+ csharp_new_line_before_finally = true
162+ csharp_new_line_before_members_in_object_initializers = true
163+ csharp_new_line_before_members_in_anonymous_types = true
164+ csharp_new_line_between_query_expression_clauses = true
165+
166+ # Indentation
167+ csharp_indent_block_contents = true
168+ csharp_indent_braces = false
169+ csharp_indent_case_contents = true
170+ csharp_indent_case_contents_when_block = true
171+ csharp_indent_switch_labels = true
172+ csharp_indent_labels = flush_left
173+
174+ # Spacing
175+ csharp_space_after_cast = false
176+ csharp_space_after_colon_in_inheritance_clause = true
177+ csharp_space_after_comma = true
178+ csharp_space_after_dot = false
179+ csharp_space_after_keywords_in_control_flow_statements = true
180+ csharp_space_after_semicolon_in_for_statement = true
181+ csharp_space_around_binary_operators = before_and_after
182+ csharp_space_around_declaration_statements = do_not_ignore
183+ csharp_space_before_colon_in_inheritance_clause = true
184+ csharp_space_before_comma = false
185+ csharp_space_before_dot = false
186+ csharp_space_before_open_square_brackets = false
187+ csharp_space_before_semicolon_in_for_statement = false
188+ csharp_space_between_empty_square_brackets = false
189+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
190+ csharp_space_between_method_call_name_and_opening_parenthesis = false
191+ csharp_space_between_method_call_parameter_list_parentheses = false
192+ csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
193+ csharp_space_between_method_declaration_name_and_open_parenthesis = false
194+ csharp_space_between_method_declaration_parameter_list_parentheses = false
195+ csharp_space_between_parentheses = false
196+ csharp_space_between_square_brackets = false
197+
198+ # Expression bodies
199+ csharp_style_expression_bodied_methods = false :none
200+ csharp_style_expression_bodied_constructors = false :none
201+ csharp_style_expression_bodied_operators = false :none
202+ csharp_style_expression_bodied_properties = true :none
203+ csharp_style_expression_bodied_indexers = true :none
204+ csharp_style_expression_bodied_accessors = true :none
205+
206+ # Modern language features
207+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
208+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
209+ csharp_style_inlined_variable_declaration = true :suggestion
210+ csharp_style_throw_expression = true :suggestion
211+ csharp_style_conditional_delegate_call = true :suggestion
212+ csharp_style_prefer_extended_property_pattern = true :suggestion
213+ csharp_style_prefer_init_only_properties = true :suggestion
214+
215+ # Braces
216+ csharp_prefer_braces = always:warning
217+ csharp_preserve_single_line_blocks = true
218+ csharp_preserve_single_line_statements = true
219+ dotnet_diagnostic.IDE0011.severity = warning
220+
221+ # 'var' everywhere
222+ csharp_style_var_for_built_in_types = true :warning
223+ csharp_style_var_when_type_is_apparent = true :warning
224+ csharp_style_var_elsewhere = true :warning
225+ dotnet_diagnostic.IDE0007.severity = warning
226+
227+ # XML documentation
228+ dotnet_diagnostic.SA1600.severity = suggestion # Elements must be documented
229+ dotnet_diagnostic.SA1623.severity = suggestion # Property summary must match accessor
230+
231+ # Code quality
232+ dotnet_diagnostic.IDE0040.severity = warning # Accessibility modifiers
233+ dotnet_diagnostic.IDE0052.severity = warning # Remove unread private members
234+ dotnet_diagnostic.IDE0059.severity = warning # Unused assignment
235+ dotnet_diagnostic.IDE0055.severity = warning # Formatting issues (spacing, newlines, etc.)
236+ dotnet_diagnostic.IDE0060.severity = warning # Unused parameters
237+ dotnet_diagnostic.CA1012.severity = warning # Abstract types with public ctors
238+ dotnet_diagnostic.CA1822.severity = none # Make member static
239+ dotnet_diagnostic.IDE0032.severity = warning # Use auto-property
240+ dotnet_diagnostic.CA2000.severity = warning # Dispose objects before losing scope
241+ dotnet_diagnostic.CA1802.severity = warning # Use literals where appropriate
242+ dotnet_diagnostic.CA1826.severity = warning # Use predicate in Any() instead of Where().Any()
243+ dotnet_diagnostic.CA1828.severity = warning # Use Count property directly instead of LINQ Count()
244+ dotnet_diagnostic.CA1829.severity = warning # Use Length/Count instead of LINQ Count() for performance
245+ dotnet_diagnostic.CA1858.severity = warning # Avoid redundant type checks like (object)x is string
246+ dotnet_diagnostic.CA1860.severity = warning # Use TryGetValue instead of ContainsKey followed by index
247+ dotnet_diagnostic.CA1868.severity = warning # Use indexing instead of ElementAt() when possible
248+ dotnet_diagnostic.CA1869.severity = warning # Avoid LINQ FirstOrDefault on arrays when index access is better
249+ dotnet_diagnostic.CA1871.severity = warning # Prefer optimized collection initialization patterns
250+ dotnet_diagnostic.CA1502.severity = warning # Avoid excessive complexity
251+
252+ # #########################################
253+ # Experimental Visual Spacing Rules
254+ # #########################################
255+
256+ dotnet_diagnostic.IDE2001.severity = warning
257+ dotnet_diagnostic.IDE2002.severity = warning
258+ dotnet_diagnostic.IDE2004.severity = warning
259+ dotnet_diagnostic.IDE2005.severity = warning
260+ dotnet_diagnostic.IDE2006.severity = warning
261+ csharp_style_expression_bodied_lambdas = true :silent
262+ csharp_style_expression_bodied_local_functions = false :silent
263+
264+ # #########################################
265+ # Exceptions by path
266+ # #########################################
267+
268+ [src/{Compilers,ExpressionEvaluator,Scripting}/** Test** /* .{cs,vb} ]
269+ dotnet_diagnostic.IDE0060.severity = none
270+
271+ [src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/** /* .{cs,vb} ]
272+ # Reserved for future path-specific rules
273+
274+ [src/{VisualStudio}/** /* .{cs,vb} ]
275+ dotnet_code_quality.CA1822.api_surface = private
0 commit comments