Skip to content

Commit d1e3405

Browse files
danielcweberOren Novotny
authored andcommitted
Copy .editorconfig from dotnet/corefx repo (#584)
* Copy .editorconfig from https://github.com/dotnet/corefx/blob/master/.editorconfig, delete the overriding .editorconfig in Rx.NET. * Deviations for this repo. * Use pascal case for static fields, without s_ prefix. * Omit default accessibility modifiers. * Prefer inferred names. * Add indent_size = 2 for yaml files.
1 parent 0c5a53f commit d1e3405

File tree

2 files changed

+127
-124
lines changed

2 files changed

+127
-124
lines changed

.editorconfig

Lines changed: 127 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,165 @@
1-
# EditorConfig is awesome:http://EditorConfig.org
2-
# From https://raw.githubusercontent.com/dotnet/roslyn/master/.editorconfig
1+
# editorconfig.org
32

43
# top-most EditorConfig file
54
root = true
65

7-
# Don't use tabs for indentation.
6+
# Default settings:
7+
# A newline ending every file
8+
# Use 4 spaces as indentation
89
[*]
10+
insert_final_newline = true
911
indent_style = space
10-
# (Please don't specify an indent_size here; that has too many unintended consequences.)
11-
12-
# Code files
13-
[*.{cs,csx,vb,vbx}]
1412
indent_size = 4
1513

16-
# Xml project files
17-
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
14+
[project.json]
1815
indent_size = 2
1916

20-
# Xml config files
21-
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
22-
indent_size = 2
17+
# C# files
18+
[*.cs]
19+
# New line preferences
20+
csharp_new_line_before_open_brace = all
21+
csharp_new_line_before_else = true
22+
csharp_new_line_before_catch = true
23+
csharp_new_line_before_finally = true
24+
csharp_new_line_before_members_in_object_initializers = true
25+
csharp_new_line_before_members_in_anonymous_types = true
26+
csharp_new_line_between_query_expression_clauses = true
2327

24-
# JSON files
25-
[*.json]
26-
indent_size = 2
28+
# Indentation preferences
29+
csharp_indent_block_contents = true
30+
csharp_indent_braces = false
31+
csharp_indent_case_contents = true
32+
csharp_indent_switch_labels = true
33+
csharp_indent_labels = one_less_than_current
2734

28-
# Dotnet code style settings:
29-
[*.{cs,vb}]
30-
# Sort using and Import directives with System.* appearing first
31-
dotnet_sort_system_directives_first = true
32-
# Avoid "this." and "Me." if not necessary
35+
# avoid this. unless absolutely necessary
3336
dotnet_style_qualification_for_field = false:suggestion
3437
dotnet_style_qualification_for_property = false:suggestion
3538
dotnet_style_qualification_for_method = false:suggestion
3639
dotnet_style_qualification_for_event = false:suggestion
3740

38-
# Use language keywords instead of framework type names for type references
41+
# use var everywhere
42+
csharp_style_var_for_built_in_types = true:suggestion
43+
csharp_style_var_when_type_is_apparent = true:suggestion
44+
csharp_style_var_elsewhere = true:suggestion
45+
46+
# use language keywords instead of BCL types
3947
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
4048
dotnet_style_predefined_type_for_member_access = true:suggestion
4149

42-
# Suggest more modern language features when available
50+
# name all constant fields using PascalCase
51+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
52+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
53+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
54+
55+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
56+
dotnet_naming_symbols.constant_fields.required_modifiers = const
57+
58+
# name all static fields using PascalCase
59+
dotnet_naming_rule.static_fields_should_be_pascal_case.severity = suggestion
60+
dotnet_naming_rule.static_fields_should_be_pascal_case.symbols = static_fields
61+
dotnet_naming_rule.static_fields_should_be_pascal_case.style = pascal_case_style
62+
63+
dotnet_naming_symbols.static_fields.applicable_kinds = field
64+
dotnet_naming_symbols.static_fields.required_modifiers = static
65+
66+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
67+
68+
# internal and private fields should be _camelCase
69+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
70+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
71+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
72+
73+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
74+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
75+
76+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
77+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
78+
79+
# Code style defaults
80+
dotnet_sort_system_directives_first = true
81+
dotnet_style_require_accessibility_modifiers = omit_if_default
82+
csharp_preserve_single_line_blocks = true
83+
csharp_preserve_single_line_statements = false
84+
85+
# Expression-level preferences
4386
dotnet_style_object_initializer = true:suggestion
4487
dotnet_style_collection_initializer = true:suggestion
88+
dotnet_style_explicit_tuple_names = true:suggestion
89+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
90+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
4591
dotnet_style_coalesce_expression = true:suggestion
4692
dotnet_style_null_propagation = true:suggestion
47-
dotnet_style_explicit_tuple_names = true:suggestion
4893

49-
# CSharp code style settings:
50-
[*.cs]
51-
# Prefer "var" everywhere
52-
csharp_style_var_for_built_in_types = true:suggestion
53-
csharp_style_var_when_type_is_apparent = true:suggestion
54-
csharp_style_var_elsewhere = true:suggestion
55-
56-
# Prefer method-like constructs to have a block body
94+
# Expression-bodied members
5795
csharp_style_expression_bodied_methods = false:none
5896
csharp_style_expression_bodied_constructors = false:none
5997
csharp_style_expression_bodied_operators = false:none
60-
61-
# Prefer property-like constructs to have an expression-body
6298
csharp_style_expression_bodied_properties = true:none
6399
csharp_style_expression_bodied_indexers = true:none
64100
csharp_style_expression_bodied_accessors = true:none
65101

66-
# Suggest more modern language features when available
102+
# Pattern matching
67103
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
68104
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
69105
csharp_style_inlined_variable_declaration = true:suggestion
106+
107+
# Null checking preferences
70108
csharp_style_throw_expression = true:suggestion
71109
csharp_style_conditional_delegate_call = true:suggestion
72110

73-
# Newline settings
74-
csharp_new_line_before_open_brace = all
75-
csharp_new_line_before_else = true
76-
csharp_new_line_before_catch = true
77-
csharp_new_line_before_finally = true
78-
csharp_new_line_before_members_in_object_initializers = true
79-
csharp_new_line_before_members_in_anonymous_types = true
111+
# Space preferences
112+
csharp_space_after_cast = false
113+
csharp_space_after_colon_in_inheritance_clause = true
114+
csharp_space_after_comma = true
115+
csharp_space_after_dot = false
116+
csharp_space_after_keywords_in_control_flow_statements = true
117+
csharp_space_after_semicolon_in_for_statement = true
118+
csharp_space_around_binary_operators = before_and_after
119+
csharp_space_around_declaration_statements = do_not_ignore
120+
csharp_space_before_colon_in_inheritance_clause = true
121+
csharp_space_before_comma = false
122+
csharp_space_before_dot = false
123+
csharp_space_before_open_square_brackets = false
124+
csharp_space_before_semicolon_in_for_statement = false
125+
csharp_space_between_empty_square_brackets = false
126+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
127+
csharp_space_between_method_call_name_and_opening_parenthesis = false
128+
csharp_space_between_method_call_parameter_list_parentheses = false
129+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
130+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
131+
csharp_space_between_method_declaration_parameter_list_parentheses = false
132+
csharp_space_between_parentheses = false
133+
csharp_space_between_square_brackets = false
134+
135+
# C++ Files
136+
[*.{cpp,h,in}]
137+
curly_bracket_next_line = true
138+
indent_brace_style = Allman
139+
140+
# Xml project files
141+
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
142+
indent_size = 2
143+
144+
# Xml build files
145+
[*.builds]
146+
indent_size = 2
147+
148+
# Yml/Yaml files
149+
[*.{yaml,yml}]
150+
indent_size = 2
151+
152+
# Xml files
153+
[*.{xml,stylecop,resx,ruleset}]
154+
indent_size = 2
155+
156+
# Xml config files
157+
[*.{props,targets,config,nuspec}]
158+
indent_size = 2
159+
160+
# Shell scripts
161+
[*.sh]
162+
end_of_line = lf
163+
164+
[*.{cmd, bat}]
165+
end_of_line = crlf

Rx.NET/Source/.editorconfig

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)