1- # https://github.com/dotnet/coreclr/blob/master/.editorconfig
1+ # Source: https://github.com/dotnet/coreclr/blob/master/.editorconfig
2+
3+ # editorconfig.org
24
35# top-most EditorConfig file
46root = true
@@ -11,6 +13,9 @@ insert_final_newline = true
1113indent_style = space
1214indent_size = 4
1315
16+ [project.json ]
17+ indent_size = 2
18+
1419# C# files
1520[* .cs ]
1621# New line preferences
@@ -26,75 +31,89 @@ csharp_new_line_between_query_expression_clauses = true
2631csharp_indent_block_contents = true
2732csharp_indent_braces = false
2833csharp_indent_case_contents = true
34+ csharp_indent_case_contents_when_block = true
2935csharp_indent_switch_labels = true
3036csharp_indent_labels = one_less_than_current
3137
38+ # Modifier preferences
39+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
40+
3241# avoid this. unless absolutely necessary
3342dotnet_style_qualification_for_field = false :suggestion
3443dotnet_style_qualification_for_property = false :suggestion
3544dotnet_style_qualification_for_method = false :suggestion
3645dotnet_style_qualification_for_event = false :suggestion
3746
38- # only use var when it's obvious what the variable type is
39- csharp_style_var_for_built_in_types = false :none
47+ # Types: use keywords instead of BCL types, and permit var only when the type is clear
48+ csharp_style_var_for_built_in_types = false :suggestion
4049csharp_style_var_when_type_is_apparent = false :none
4150csharp_style_var_elsewhere = false :suggestion
42-
43- # use language keywords instead of BCL types
4451dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
4552dotnet_style_predefined_type_for_member_access = true :suggestion
4653
4754# name all constant fields using PascalCase
4855dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
4956dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
5057dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
51-
5258dotnet_naming_symbols.constant_fields.applicable_kinds = field
5359dotnet_naming_symbols.constant_fields.required_modifiers = const
54-
5560dotnet_naming_style.pascal_case_style.capitalization = pascal_case
5661
5762# static fields should have s_ prefix
5863dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
5964dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
6065dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
61-
6266dotnet_naming_symbols.static_fields.applicable_kinds = field
6367dotnet_naming_symbols.static_fields.required_modifiers = static
64-
6568dotnet_naming_style.static_prefix_style.required_prefix = s_
6669dotnet_naming_style.static_prefix_style.capitalization = camel_case
6770
6871# internal and private fields should be _camelCase
6972dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
7073dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
7174dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
72-
7375dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
7476dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
75-
7677dotnet_naming_style.camel_case_underscore_style.required_prefix = _
7778dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
7879
7980# Code style defaults
80- dotnet_sort_system_directives_first = true
81- csharp_preserve_single_line_blocks = true
82- csharp_preserve_single_line_statements = false
81+ csharp_using_directive_placement = outside_namespace:suggestion
82+ dotnet_sort_system_directives_first = true :suggestion
83+ csharp_prefer_braces = true:refactoring
84+ csharp_preserve_single_line_blocks = true :none
85+ csharp_preserve_single_line_statements = false :none
86+ csharp_prefer_static_local_function = true :suggestion
87+ csharp_prefer_simple_using_statement = false :none
88+ csharp_style_prefer_switch_expression = true :suggestion
89+
90+ # Code quality
91+ dotnet_style_readonly_field = true :suggestion
92+ dotnet_code_quality_unused_parameters = non_public:suggestion
8393
8494# Expression-level preferences
8595dotnet_style_object_initializer = true :suggestion
8696dotnet_style_collection_initializer = true :suggestion
8797dotnet_style_explicit_tuple_names = true :suggestion
8898dotnet_style_coalesce_expression = true :suggestion
8999dotnet_style_null_propagation = true :suggestion
100+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
101+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
102+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
103+ dotnet_style_prefer_auto_properties = true :suggestion
104+ dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
105+ dotnet_style_prefer_conditional_expression_over_return = true:refactoring
106+ csharp_prefer_simple_default_expression = true :suggestion
90107
91108# Expression-bodied members
92- csharp_style_expression_bodied_methods = false :none
93- csharp_style_expression_bodied_constructors = false :none
94- csharp_style_expression_bodied_operators = false :none
95- csharp_style_expression_bodied_properties = true :none
96- csharp_style_expression_bodied_indexers = true :none
97- csharp_style_expression_bodied_accessors = true :none
109+ csharp_style_expression_bodied_methods = true:refactoring
110+ csharp_style_expression_bodied_constructors = true:refactoring
111+ csharp_style_expression_bodied_operators = true:refactoring
112+ csharp_style_expression_bodied_properties = true:refactoring
113+ csharp_style_expression_bodied_indexers = true:refactoring
114+ csharp_style_expression_bodied_accessors = true:refactoring
115+ csharp_style_expression_bodied_lambdas = true:refactoring
116+ csharp_style_expression_bodied_local_functions = true:refactoring
98117
99118# Pattern matching
100119csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
@@ -105,6 +124,11 @@ csharp_style_inlined_variable_declaration = true:suggestion
105124csharp_style_throw_expression = true :suggestion
106125csharp_style_conditional_delegate_call = true :suggestion
107126
127+ # Other features
128+ csharp_style_prefer_index_operator = false :none
129+ csharp_style_prefer_range_operator = false :none
130+ csharp_style_pattern_local_over_anonymous_function = false :none
131+
108132# Space preferences
109133csharp_space_after_cast = false
110134csharp_space_after_colon_in_inheritance_clause = true
@@ -129,19 +153,32 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
129153csharp_space_between_parentheses = false
130154csharp_space_between_square_brackets = false
131155
132- [* .{asm,inc} ]
133- indent_size = 8
156+ # Analyzers
157+ dotnet_code_quality.ca1802.api_surface = private, internal
158+
159+ # C++ Files
160+ [* .{cpp,h,in} ]
161+ curly_bracket_next_line = true
162+ indent_brace_style = Allman
134163
135164# Xml project files
136165[* .{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj} ]
137166indent_size = 2
138167
139- # Xml config files
140- [* .{props,targets,config,nuspec} ]
168+ # Xml build files
169+ [* .builds ]
141170indent_size = 2
142171
143- [CMakeLists.txt ]
172+ # Xml files
173+ [* .{xml,stylecop,resx,ruleset} ]
144174indent_size = 2
145175
146- [* .cmd ]
176+ # Xml config files
177+ [* .{props,targets,config,nuspec} ]
147178indent_size = 2
179+
180+ # Shell scripts
181+ [* .sh ]
182+ end_of_line = lf
183+ [* .{cmd, bat} ]
184+ end_of_line = crlf
0 commit comments