Skip to content

Commit a8f5e31

Browse files
committed
Add .editorconfig and reformat some tabs to spaces
1 parent 9a45773 commit a8f5e31

File tree

3 files changed

+444
-178
lines changed

3 files changed

+444
-178
lines changed

.editorconfig

Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Don't use tabs for indentation.
7+
[*]
8+
indent_style = space
9+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
10+
11+
# Code files
12+
[*.{cs,csx,vb,vbx}]
13+
indent_size = 4
14+
insert_final_newline = true
15+
16+
# XML project files
17+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
18+
indent_size = 2
19+
20+
# XML config files
21+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
22+
indent_size = 2
23+
24+
# Powershell files
25+
[*.ps1]
26+
indent_size = 2
27+
28+
# Shell script files
29+
[*.sh]
30+
end_of_line = lf
31+
indent_size = 2
32+
33+
# Dotnet code style settings:
34+
[*.{cs,vb}]
35+
36+
# IDE0055: Fix formatting
37+
dotnet_diagnostic.IDE0055.severity = warning
38+
39+
# Sort using and Import directives with System.* appearing first
40+
dotnet_sort_system_directives_first = true
41+
dotnet_separate_import_directive_groups = false
42+
# Avoid "this." and "Me." if not necessary
43+
dotnet_style_qualification_for_field = false:refactoring
44+
dotnet_style_qualification_for_property = false:refactoring
45+
dotnet_style_qualification_for_method = false:refactoring
46+
dotnet_style_qualification_for_event = false:refactoring
47+
48+
# Use language keywords instead of framework type names for type references
49+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
50+
dotnet_style_predefined_type_for_member_access = true:suggestion
51+
52+
# Suggest more modern language features when available
53+
dotnet_style_object_initializer = true:suggestion
54+
dotnet_style_collection_initializer = true:suggestion
55+
dotnet_style_coalesce_expression = true:suggestion
56+
dotnet_style_null_propagation = true:suggestion
57+
dotnet_style_explicit_tuple_names = true:suggestion
58+
59+
# Whitespace options
60+
dotnet_style_allow_multiple_blank_lines_experimental = false
61+
62+
# Constants are PascalCase
63+
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
64+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
65+
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
66+
67+
dotnet_naming_symbols.constants.applicable_kinds = field, local
68+
dotnet_naming_symbols.constants.required_modifiers = const
69+
70+
dotnet_naming_style.constant_style.capitalization = pascal_case
71+
72+
# Static fields are camelCase and start with s_
73+
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
74+
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
75+
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
76+
77+
dotnet_naming_symbols.static_fields.applicable_kinds = field
78+
dotnet_naming_symbols.static_fields.required_modifiers = static
79+
80+
dotnet_naming_style.static_field_style.capitalization = camel_case
81+
dotnet_naming_style.static_field_style.required_prefix = s_
82+
83+
# Instance fields are camelCase and start with _
84+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
85+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
86+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
87+
88+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
89+
90+
dotnet_naming_style.instance_field_style.capitalization = camel_case
91+
dotnet_naming_style.instance_field_style.required_prefix = _
92+
93+
# Locals and parameters are camelCase
94+
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
95+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
96+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
97+
98+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
99+
100+
dotnet_naming_style.camel_case_style.capitalization = camel_case
101+
102+
# Local functions are PascalCase
103+
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
104+
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
105+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
106+
107+
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
108+
109+
dotnet_naming_style.local_function_style.capitalization = pascal_case
110+
111+
# By default, name items with PascalCase
112+
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
113+
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
114+
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
115+
116+
dotnet_naming_symbols.all_members.applicable_kinds = *
117+
118+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
119+
120+
# error RS2008: Enable analyzer release tracking for the analyzer project containing rule '{0}'
121+
dotnet_diagnostic.RS2008.severity = none
122+
123+
# IDE0035: Remove unreachable code
124+
dotnet_diagnostic.IDE0035.severity = warning
125+
126+
# IDE0036: Order modifiers
127+
dotnet_diagnostic.IDE0036.severity = warning
128+
129+
# IDE0043: Format string contains invalid placeholder
130+
dotnet_diagnostic.IDE0043.severity = warning
131+
132+
# IDE0044: Make field readonly
133+
dotnet_diagnostic.IDE0044.severity = warning
134+
135+
# RS0016: Only enable if API files are present
136+
dotnet_public_api_analyzer.require_api_files = true
137+
138+
# CSharp code style settings:
139+
[*.cs]
140+
# Newline settings
141+
csharp_new_line_before_open_brace = all
142+
csharp_new_line_before_else = true
143+
csharp_new_line_before_catch = true
144+
csharp_new_line_before_finally = true
145+
csharp_new_line_before_members_in_object_initializers = true
146+
csharp_new_line_before_members_in_anonymous_types = true
147+
csharp_new_line_between_query_expression_clauses = true
148+
149+
# Indentation preferences
150+
csharp_indent_block_contents = true
151+
csharp_indent_braces = false
152+
csharp_indent_case_contents = true
153+
csharp_indent_case_contents_when_block = true
154+
csharp_indent_switch_labels = true
155+
csharp_indent_labels = flush_left
156+
157+
# Whitespace options
158+
csharp_style_allow_embedded_statements_on_same_line_experimental = false
159+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
160+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
161+
162+
# Prefer "var" everywhere
163+
csharp_style_var_for_built_in_types = true:suggestion
164+
csharp_style_var_when_type_is_apparent = true:suggestion
165+
csharp_style_var_elsewhere = true:suggestion
166+
167+
# Prefer method-like constructs to have a block body
168+
csharp_style_expression_bodied_methods = false:none
169+
csharp_style_expression_bodied_constructors = false:none
170+
csharp_style_expression_bodied_operators = false:none
171+
172+
# Prefer property-like constructs to have an expression-body
173+
csharp_style_expression_bodied_properties = true:none
174+
csharp_style_expression_bodied_indexers = true:none
175+
csharp_style_expression_bodied_accessors = true:none
176+
177+
# Suggest more modern language features when available
178+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
179+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
180+
csharp_style_inlined_variable_declaration = true:suggestion
181+
csharp_style_throw_expression = true:suggestion
182+
csharp_style_conditional_delegate_call = true:suggestion
183+
184+
# Space preferences
185+
csharp_space_after_cast = true
186+
csharp_space_after_colon_in_inheritance_clause = true
187+
csharp_space_after_comma = true
188+
csharp_space_after_dot = false
189+
csharp_space_after_keywords_in_control_flow_statements = true
190+
csharp_space_after_semicolon_in_for_statement = true
191+
csharp_space_around_binary_operators = before_and_after
192+
csharp_space_around_declaration_statements = do_not_ignore
193+
csharp_space_before_colon_in_inheritance_clause = true
194+
csharp_space_before_comma = false
195+
csharp_space_before_dot = false
196+
csharp_space_before_open_square_brackets = false
197+
csharp_space_before_semicolon_in_for_statement = false
198+
csharp_space_between_empty_square_brackets = false
199+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
200+
csharp_space_between_method_call_name_and_opening_parenthesis = false
201+
csharp_space_between_method_call_parameter_list_parentheses = false
202+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
203+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
204+
csharp_space_between_method_declaration_parameter_list_parentheses = false
205+
csharp_space_between_parentheses = false
206+
csharp_space_between_square_brackets = false
207+
208+
# Blocks are allowed
209+
csharp_prefer_braces = true:silent
210+
csharp_preserve_single_line_blocks = true
211+
csharp_preserve_single_line_statements = true
212+
213+
# Currently only enabled for C# due to crash in VB analyzer. VB can be enabled once
214+
# https://github.com/dotnet/roslyn/pull/54259 has been published.
215+
dotnet_style_allow_statement_immediately_after_block_experimental = false
216+
217+
[src/CodeStyle/**.{cs,vb}]
218+
# warning RS0005: Do not use generic CodeAction.Create to create CodeAction
219+
dotnet_diagnostic.RS0005.severity = none
220+
221+
[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}]
222+
223+
# IDE0011: Add braces
224+
csharp_prefer_braces = when_multiline:warning
225+
# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
226+
dotnet_diagnostic.IDE0011.severity = warning
227+
228+
# IDE0040: Add accessibility modifiers
229+
dotnet_diagnostic.IDE0040.severity = warning
230+
231+
# CONSIDER: Are IDE0051 and IDE0052 too noisy to be warnings for IDE editing scenarios? Should they be made build-only warnings?
232+
# IDE0051: Remove unused private member
233+
dotnet_diagnostic.IDE0051.severity = warning
234+
235+
# IDE0052: Remove unread private member
236+
dotnet_diagnostic.IDE0052.severity = warning
237+
238+
# IDE0059: Unnecessary assignment to a value
239+
dotnet_diagnostic.IDE0059.severity = warning
240+
241+
# IDE0060: Remove unused parameter
242+
dotnet_diagnostic.IDE0060.severity = warning
243+
244+
# CA1012: Abstract types should not have public constructors
245+
dotnet_diagnostic.CA1012.severity = warning
246+
247+
# CA1822: Make member static
248+
dotnet_diagnostic.CA1822.severity = warning
249+
250+
# Prefer "var" everywhere
251+
dotnet_diagnostic.IDE0007.severity = warning
252+
csharp_style_var_for_built_in_types = true:warning
253+
csharp_style_var_when_type_is_apparent = true:warning
254+
csharp_style_var_elsewhere = true:warning
255+
256+
# dotnet_style_allow_multiple_blank_lines_experimental
257+
dotnet_diagnostic.IDE2000.severity = warning
258+
259+
# csharp_style_allow_embedded_statements_on_same_line_experimental
260+
dotnet_diagnostic.IDE2001.severity = warning
261+
262+
# csharp_style_allow_blank_lines_between_consecutive_braces_experimental
263+
dotnet_diagnostic.IDE2002.severity = warning
264+
265+
# dotnet_style_allow_statement_immediately_after_block_experimental
266+
dotnet_diagnostic.IDE2003.severity = warning
267+
268+
# csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental
269+
dotnet_diagnostic.IDE2004.severity = warning
270+
271+
[src/{VisualStudio}/**/*.{cs,vb}]
272+
# CA1822: Make member static
273+
# Not enforced as a build 'warning' for 'VisualStudio' layer due to large number of false positives from https://github.com/dotnet/roslyn-analyzers/issues/3857 and https://github.com/dotnet/roslyn-analyzers/issues/3858
274+
# Additionally, there is a risk of accidentally breaking an internal API that partners rely on though IVT.
275+
dotnet_diagnostic.CA1822.severity = suggestion

0 commit comments

Comments
 (0)