1# editorconfig.org
2
3# top-most EditorConfig file
4root = true
5
6# Default settings:
7# A newline ending every file
8# Use 4 spaces as indentation
9[*]
10insert_final_newline = true
11indent_style = space
12indent_size = 4
13
14[project.json]
15indent_size = 2
16
17# C# files
18[*.cs]
19# New line preferences
20csharp_new_line_before_open_brace = all
21csharp_new_line_before_else = true
22csharp_new_line_before_catch = true
23csharp_new_line_before_finally = true
24csharp_new_line_before_members_in_object_initializers = true
25csharp_new_line_before_members_in_anonymous_types = true
26csharp_new_line_within_query_expression_clauses = true
27
28# Indentation preferences
29csharp_indent_block_contents = true
30csharp_indent_braces = false
31csharp_indent_case_contents = true
32csharp_indent_switch_labels = true
33csharp_indent_labels = flush_left
34
35# avoid this. unless absolutely necessary
36dotnet_style_qualification_for_field = false:suggestion
37dotnet_style_qualification_for_property = false:suggestion
38dotnet_style_qualification_for_method = false:suggestion
39dotnet_style_qualification_for_event = false:suggestion
40
41# only use var when it's obvious what the variable type is
42csharp_style_var_for_built_in_types = false:none
43csharp_style_var_when_type_is_apparent = false:none
44csharp_style_var_elsewhere = false:suggestion
45
46# use language keywords instead of BCL types
47dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
48dotnet_style_predefined_type_for_member_access = true:suggestion
49
50# name all constant fields using PascalCase
51dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
52dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols  = constant_fields
53dotnet_naming_rule.constant_fields_should_be_pascal_case.style    = pascal_case_style
54
55dotnet_naming_symbols.constant_fields.applicable_kinds   = field
56dotnet_naming_symbols.constant_fields.required_modifiers = const
57
58dotnet_naming_style.pascal_case_style.capitalization = pascal_case
59
60# static fields should have s_ prefix
61dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
62dotnet_naming_rule.static_fields_should_have_prefix.symbols  = static_fields
63dotnet_naming_rule.static_fields_should_have_prefix.style    = static_prefix_style
64
65dotnet_naming_symbols.static_fields.applicable_kinds   = field
66dotnet_naming_symbols.static_fields.required_modifiers = static
67
68dotnet_naming_style.static_prefix_style.required_prefix = s_
69dotnet_naming_style.static_prefix_style.capitalization = camel_case
70
71# internal and private fields should be _camelCase
72dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
73dotnet_naming_rule.camel_case_for_private_internal_fields.symbols  = private_internal_fields
74dotnet_naming_rule.camel_case_for_private_internal_fields.style    = camel_case_underscore_style
75
76dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
77dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
78
79dotnet_naming_style.camel_case_underscore_style.required_prefix = _
80dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
81
82# Code style defaults
83dotnet_sort_system_directives_first = true
84csharp_preserve_single_line_blocks = true
85csharp_preserve_single_line_statements = false
86
87# Expression-level preferences
88dotnet_style_object_initializer = true:suggestion
89dotnet_style_collection_initializer = true:suggestion
90dotnet_style_explicit_tuple_names = true:suggestion
91dotnet_style_coalesce_expression = true:suggestion
92dotnet_style_null_propagation = true:suggestion
93
94# Expression-bodied members
95csharp_style_expression_bodied_methods = false:none
96csharp_style_expression_bodied_constructors = false:none
97csharp_style_expression_bodied_operators = false:none
98csharp_style_expression_bodied_properties = true:none
99csharp_style_expression_bodied_indexers = true:none
100csharp_style_expression_bodied_accessors = true:none
101
102# Pattern matching
103csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
104csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
105csharp_style_inlined_variable_declaration = true:suggestion
106
107# Null checking preferences
108csharp_style_throw_expression = true:suggestion
109csharp_style_conditional_delegate_call = true:suggestion
110
111# Space preferences
112csharp_space_after_cast = false
113csharp_space_after_colon_in_inheritance_clause = true
114csharp_space_after_comma = true
115csharp_space_after_dot = false
116csharp_space_after_keywords_in_control_flow_statements = true
117csharp_space_after_semicolon_in_for_statement = true
118csharp_space_around_binary_operators = before_and_after
119csharp_space_around_declaration_statements = do_not_ignore
120csharp_space_before_colon_in_inheritance_clause = true
121csharp_space_before_comma = false
122csharp_space_before_dot = false
123csharp_space_before_open_square_brackets = false
124csharp_space_before_semicolon_in_for_statement = false
125csharp_space_between_empty_square_brackets = false
126csharp_space_between_method_call_empty_parameter_list_parentheses = false
127csharp_space_between_method_call_name_and_opening_parenthesis = false
128csharp_space_between_method_call_parameter_list_parentheses = false
129csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
130csharp_space_between_method_declaration_name_and_open_parenthesis = false
131csharp_space_between_method_declaration_parameter_list_parentheses = false
132csharp_space_between_parentheses = false
133csharp_space_between_square_brackets = false
134
135# C++ Files
136[*.{cpp,h,in}]
137curly_bracket_next_line = true
138indent_brace_style = Allman
139
140# Xml project files
141[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
142indent_size = 2
143
144# Xml build files
145[*.builds]
146indent_size = 2
147
148# Xml files
149[*.{xml,stylecop,resx,ruleset}]
150indent_size = 2
151
152# Xml config files
153[*.{props,targets,config,nuspec}]
154indent_size = 2
155
156# Shell scripts
157[*.sh]
158end_of_line = lf
159[*.{cmd, bat}]
160end_of_line = crlf
161