Skip to content

Commit 3ee1383

Browse files
authored
Update coreclr's .editorconfig to match corefx's (dotnet#26214)
1 parent f17ece0 commit 3ee1383

File tree

1 file changed

+61
-27
lines changed

1 file changed

+61
-27
lines changed

.editorconfig

+61-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# EditorConfig is awesome:
2-
http://EditorConfig.org
1+
# editorconfig.org
32

43
# top-most EditorConfig file
54
root = true
@@ -12,6 +11,9 @@ insert_final_newline = true
1211
indent_style = space
1312
indent_size = 4
1413

14+
[project.json]
15+
indent_size = 2
16+
1517
# C# files
1618
[*.cs]
1719
# New line preferences
@@ -27,75 +29,89 @@ csharp_new_line_between_query_expression_clauses = true
2729
csharp_indent_block_contents = true
2830
csharp_indent_braces = false
2931
csharp_indent_case_contents = true
32+
csharp_indent_case_contents_when_block = true
3033
csharp_indent_switch_labels = true
3134
csharp_indent_labels = one_less_than_current
3235

36+
# Modifier preferences
37+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
38+
3339
# avoid this. unless absolutely necessary
3440
dotnet_style_qualification_for_field = false:suggestion
3541
dotnet_style_qualification_for_property = false:suggestion
3642
dotnet_style_qualification_for_method = false:suggestion
3743
dotnet_style_qualification_for_event = false:suggestion
3844

39-
# only use var when it's obvious what the variable type is
40-
csharp_style_var_for_built_in_types = false:none
45+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
46+
csharp_style_var_for_built_in_types = false:suggestion
4147
csharp_style_var_when_type_is_apparent = false:none
4248
csharp_style_var_elsewhere = false:suggestion
43-
44-
# use language keywords instead of BCL types
4549
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
4650
dotnet_style_predefined_type_for_member_access = true:suggestion
4751

4852
# name all constant fields using PascalCase
4953
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
5054
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
5155
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
52-
5356
dotnet_naming_symbols.constant_fields.applicable_kinds = field
5457
dotnet_naming_symbols.constant_fields.required_modifiers = const
55-
5658
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
5759

5860
# static fields should have s_ prefix
5961
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
6062
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
6163
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
62-
6364
dotnet_naming_symbols.static_fields.applicable_kinds = field
6465
dotnet_naming_symbols.static_fields.required_modifiers = static
65-
6666
dotnet_naming_style.static_prefix_style.required_prefix = s_
6767
dotnet_naming_style.static_prefix_style.capitalization = camel_case
6868

6969
# internal and private fields should be _camelCase
7070
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
7171
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
7272
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
73-
7473
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
7574
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
76-
7775
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
7876
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
7977

8078
# Code style defaults
81-
dotnet_sort_system_directives_first = true
82-
csharp_preserve_single_line_blocks = true
83-
csharp_preserve_single_line_statements = false
79+
csharp_using_directive_placement = outside_namespace:suggestion
80+
dotnet_sort_system_directives_first = true:suggestion
81+
csharp_prefer_braces = true:refactoring
82+
csharp_preserve_single_line_blocks = true:none
83+
csharp_preserve_single_line_statements = false:none
84+
csharp_prefer_static_local_function = true:suggestion
85+
csharp_prefer_simple_using_statement = false:none
86+
csharp_style_prefer_switch_expression = true:suggestion
87+
88+
# Code quality
89+
dotnet_style_readonly_field = true:suggestion
90+
dotnet_code_quality_unused_parameters = non_public:suggestion
8491

8592
# Expression-level preferences
8693
dotnet_style_object_initializer = true:suggestion
8794
dotnet_style_collection_initializer = true:suggestion
8895
dotnet_style_explicit_tuple_names = true:suggestion
8996
dotnet_style_coalesce_expression = true:suggestion
9097
dotnet_style_null_propagation = true:suggestion
98+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
99+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
100+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
101+
dotnet_style_prefer_auto_properties = true:suggestion
102+
dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
103+
dotnet_style_prefer_conditional_expression_over_return = true:refactoring
104+
csharp_prefer_simple_default_expression = true:suggestion
91105

92106
# Expression-bodied members
93-
csharp_style_expression_bodied_methods = false:none
94-
csharp_style_expression_bodied_constructors = false:none
95-
csharp_style_expression_bodied_operators = false:none
96-
csharp_style_expression_bodied_properties = true:none
97-
csharp_style_expression_bodied_indexers = true:none
98-
csharp_style_expression_bodied_accessors = true:none
107+
csharp_style_expression_bodied_methods = true:refactoring
108+
csharp_style_expression_bodied_constructors = true:refactoring
109+
csharp_style_expression_bodied_operators = true:refactoring
110+
csharp_style_expression_bodied_properties = true:refactoring
111+
csharp_style_expression_bodied_indexers = true:refactoring
112+
csharp_style_expression_bodied_accessors = true:refactoring
113+
csharp_style_expression_bodied_lambdas = true:refactoring
114+
csharp_style_expression_bodied_local_functions = true:refactoring
99115

100116
# Pattern matching
101117
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
@@ -106,6 +122,11 @@ csharp_style_inlined_variable_declaration = true:suggestion
106122
csharp_style_throw_expression = true:suggestion
107123
csharp_style_conditional_delegate_call = true:suggestion
108124

125+
# Other features
126+
csharp_style_prefer_index_operator = false:none
127+
csharp_style_prefer_range_operator = false:none
128+
csharp_style_pattern_local_over_anonymous_function = false:none
129+
109130
# Space preferences
110131
csharp_space_after_cast = false
111132
csharp_space_after_colon_in_inheritance_clause = true
@@ -130,19 +151,32 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
130151
csharp_space_between_parentheses = false
131152
csharp_space_between_square_brackets = false
132153

133-
[*.{asm,inc}]
134-
indent_size = 8
154+
# Analyzers
155+
dotnet_code_quality.ca1802.api_surface = private, internal
156+
157+
# C++ Files
158+
[*.{cpp,h,in}]
159+
curly_bracket_next_line = true
160+
indent_brace_style = Allman
135161

136162
# Xml project files
137163
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
138164
indent_size = 2
139165

140-
# Xml config files
141-
[*.{props,targets,config,nuspec}]
166+
# Xml build files
167+
[*.builds]
142168
indent_size = 2
143169

144-
[CMakeLists.txt]
170+
# Xml files
171+
[*.{xml,stylecop,resx,ruleset}]
145172
indent_size = 2
146173

147-
[*.cmd]
174+
# Xml config files
175+
[*.{props,targets,config,nuspec}]
148176
indent_size = 2
177+
178+
# Shell scripts
179+
[*.sh]
180+
end_of_line = lf
181+
[*.{cmd, bat}]
182+
end_of_line = crlf

0 commit comments

Comments
 (0)