Skip to content

Commit 7cf7332

Browse files
authored
Merge pull request #2554 from sharwell/editorconfig
Add .editorconfig
2 parents 79abcc6 + f06ed6d commit 7cf7332

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

.editorconfig

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
root = true
2+
3+
[*.cs]
4+
charset = utf-8-bom
5+
insert_final_newline = true
6+
indent_style = space
7+
indent_size = 4
8+
9+
# Sort using and Import directives with System.* appearing first
10+
dotnet_sort_system_directives_first = true
11+
12+
# Always use "this." and "Me." when applicable; let StyleCop Analyzers provide the warning and fix
13+
dotnet_style_qualification_for_field = true:none
14+
dotnet_style_qualification_for_property = true:none
15+
dotnet_style_qualification_for_method = true:none
16+
dotnet_style_qualification_for_event = true:none
17+
18+
# Use language keywords where applicable; let StyleCop Analyzers provide the warning and fix
19+
dotnet_style_predefined_type_for_locals_parameters_members = true:none
20+
dotnet_style_predefined_type_for_member_access = true:none
21+
22+
# Suggest more modern language features when available
23+
dotnet_style_object_initializer = true:none
24+
dotnet_style_collection_initializer = true:none
25+
dotnet_style_coalesce_expression = true:suggestion
26+
dotnet_style_null_propagation = true:suggestion
27+
dotnet_style_explicit_tuple_names = true:suggestion
28+
29+
# New line preferences
30+
csharp_new_line_before_open_brace = all
31+
csharp_new_line_before_else = true
32+
csharp_new_line_before_catch = true
33+
csharp_new_line_before_finally = true
34+
csharp_new_line_before_members_in_object_initializers = true
35+
csharp_new_line_before_members_in_anonymous_types = true
36+
csharp_new_line_within_query_expression_clauses = true
37+
38+
# Indentation preferences
39+
csharp_indent_block_contents = true
40+
csharp_indent_braces = false
41+
csharp_indent_case_contents = true
42+
csharp_indent_switch_labels = false
43+
csharp_indent_labels = flush_left
44+
45+
# Space preferences
46+
csharp_space_after_cast = false
47+
csharp_space_after_colon_in_inheritance_clause = true
48+
csharp_space_after_comma = true
49+
csharp_space_after_dot = false
50+
csharp_space_after_keywords_in_control_flow_statements = true
51+
csharp_space_after_semicolon_in_for_statement = true
52+
csharp_space_around_binary_operators = before_and_after
53+
csharp_space_around_declaration_statements = do_not_ignore
54+
csharp_space_before_colon_in_inheritance_clause = true
55+
csharp_space_before_comma = false
56+
csharp_space_before_dot = false
57+
csharp_space_before_open_square_brackets = false
58+
csharp_space_before_semicolon_in_for_statement = false
59+
csharp_space_between_empty_square_brackets = false
60+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
61+
csharp_space_between_method_call_name_and_opening_parenthesis = false
62+
csharp_space_between_method_call_parameter_list_parentheses = false
63+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
64+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
65+
csharp_space_between_method_declaration_parameter_list_parentheses = false
66+
csharp_space_between_parentheses = false
67+
csharp_space_between_square_brackets = false
68+
69+
# Prefer "var" only where type is obvious; disable diagnostics since no firm policy is in place yet
70+
csharp_style_var_for_built_in_types = false:none
71+
csharp_style_var_when_type_is_apparent = true:none
72+
csharp_style_var_elsewhere = false:none
73+
74+
# Prefer method-like constructs to have a block body
75+
csharp_style_expression_bodied_methods = false:none
76+
csharp_style_expression_bodied_constructors = false:none
77+
csharp_style_expression_bodied_operators = false:none
78+
79+
# Prefer property-like constructs to have an expression-body
80+
csharp_style_expression_bodied_properties = true:none
81+
csharp_style_expression_bodied_indexers = true:none
82+
csharp_style_expression_bodied_accessors = true:none
83+
84+
# Suggest more modern language features when available
85+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
86+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
87+
csharp_style_inlined_variable_declaration = true:none
88+
csharp_style_throw_expression = true:none
89+
csharp_style_conditional_delegate_call = true:suggestion

StyleCopAnalyzers.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ EndProject
1717
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5F9532E9-B126-402A-B338-54431A4882B2}"
1818
ProjectSection(SolutionItems) = preProject
1919
.codecov.yml = .codecov.yml
20+
.editorconfig = .editorconfig
2021
appveyor.yml = appveyor.yml
2122
CONTRIBUTING.md = CONTRIBUTING.md
2223
LICENSE = LICENSE

0 commit comments

Comments
 (0)