1
- # EditorConfig is awesome:
2
- http://EditorConfig.org
1
+ # editorconfig.org
3
2
4
3
# top-most EditorConfig file
5
4
root = true
@@ -12,6 +11,9 @@ insert_final_newline = true
12
11
indent_style = space
13
12
indent_size = 4
14
13
14
+ [project.json ]
15
+ indent_size = 2
16
+
15
17
# C# files
16
18
[* .cs ]
17
19
# New line preferences
@@ -27,75 +29,89 @@ csharp_new_line_between_query_expression_clauses = true
27
29
csharp_indent_block_contents = true
28
30
csharp_indent_braces = false
29
31
csharp_indent_case_contents = true
32
+ csharp_indent_case_contents_when_block = true
30
33
csharp_indent_switch_labels = true
31
34
csharp_indent_labels = one_less_than_current
32
35
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
+
33
39
# avoid this. unless absolutely necessary
34
40
dotnet_style_qualification_for_field = false :suggestion
35
41
dotnet_style_qualification_for_property = false :suggestion
36
42
dotnet_style_qualification_for_method = false :suggestion
37
43
dotnet_style_qualification_for_event = false :suggestion
38
44
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
41
47
csharp_style_var_when_type_is_apparent = false :none
42
48
csharp_style_var_elsewhere = false :suggestion
43
-
44
- # use language keywords instead of BCL types
45
49
dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
46
50
dotnet_style_predefined_type_for_member_access = true :suggestion
47
51
48
52
# name all constant fields using PascalCase
49
53
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
50
54
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
51
55
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
52
-
53
56
dotnet_naming_symbols.constant_fields.applicable_kinds = field
54
57
dotnet_naming_symbols.constant_fields.required_modifiers = const
55
-
56
58
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
57
59
58
60
# static fields should have s_ prefix
59
61
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
60
62
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
61
63
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
62
-
63
64
dotnet_naming_symbols.static_fields.applicable_kinds = field
64
65
dotnet_naming_symbols.static_fields.required_modifiers = static
65
-
66
66
dotnet_naming_style.static_prefix_style.required_prefix = s_
67
67
dotnet_naming_style.static_prefix_style.capitalization = camel_case
68
68
69
69
# internal and private fields should be _camelCase
70
70
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
71
71
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
72
72
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
73
-
74
73
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
75
74
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
76
-
77
75
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
78
76
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
79
77
80
78
# 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
84
91
85
92
# Expression-level preferences
86
93
dotnet_style_object_initializer = true :suggestion
87
94
dotnet_style_collection_initializer = true :suggestion
88
95
dotnet_style_explicit_tuple_names = true :suggestion
89
96
dotnet_style_coalesce_expression = true :suggestion
90
97
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
91
105
92
106
# 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
99
115
100
116
# Pattern matching
101
117
csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
@@ -106,6 +122,11 @@ csharp_style_inlined_variable_declaration = true:suggestion
106
122
csharp_style_throw_expression = true :suggestion
107
123
csharp_style_conditional_delegate_call = true :suggestion
108
124
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
+
109
130
# Space preferences
110
131
csharp_space_after_cast = false
111
132
csharp_space_after_colon_in_inheritance_clause = true
@@ -130,19 +151,32 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
130
151
csharp_space_between_parentheses = false
131
152
csharp_space_between_square_brackets = false
132
153
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
135
161
136
162
# Xml project files
137
163
[* .{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj} ]
138
164
indent_size = 2
139
165
140
- # Xml config files
141
- [* .{props,targets,config,nuspec} ]
166
+ # Xml build files
167
+ [* .builds ]
142
168
indent_size = 2
143
169
144
- [CMakeLists.txt ]
170
+ # Xml files
171
+ [* .{xml,stylecop,resx,ruleset} ]
145
172
indent_size = 2
146
173
147
- [* .cmd ]
174
+ # Xml config files
175
+ [* .{props,targets,config,nuspec} ]
148
176
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