Skip to content

Commit 654933a

Browse files
authored
Added .editconfig and formatted all files. (#193)
Sorted and removed unused usings.
1 parent 53d2128 commit 654933a

File tree

596 files changed

+39209
-24784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

596 files changed

+39209
-24784
lines changed

.editorconfig

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Default settings:
7+
# A newline ending every file
8+
# Use 4 spaces as indentation
9+
[*]
10+
insert_final_newline = true
11+
indent_style = space
12+
indent_size = 4
13+
14+
[project.json]
15+
indent_size = 2
16+
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
27+
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
34+
35+
# avoid this. unless absolutely necessary
36+
dotnet_style_qualification_for_field = false:suggestion
37+
dotnet_style_qualification_for_property = false:suggestion
38+
dotnet_style_qualification_for_method = false:suggestion
39+
dotnet_style_qualification_for_event = false:suggestion
40+
41+
# only use var when it's obvious what the variable type is
42+
csharp_style_var_for_built_in_types = false:none
43+
csharp_style_var_when_type_is_apparent = false:none
44+
csharp_style_var_elsewhere = false:suggestion
45+
46+
# use language keywords instead of BCL types
47+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
48+
dotnet_style_predefined_type_for_member_access = true:suggestion
49+
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+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
59+
60+
# static fields should have s_ prefix
61+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
62+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
63+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
64+
65+
dotnet_naming_symbols.static_fields.applicable_kinds = field
66+
dotnet_naming_symbols.static_fields.required_modifiers = static
67+
68+
dotnet_naming_style.static_prefix_style.required_prefix = s_
69+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
70+
71+
# internal and private fields should be _camelCase
72+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
73+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
74+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
75+
76+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
77+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
78+
79+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
80+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
81+
82+
# Code style defaults
83+
dotnet_sort_system_directives_first = true
84+
csharp_preserve_single_line_blocks = true
85+
csharp_preserve_single_line_statements = false
86+
87+
# Expression-level preferences
88+
dotnet_style_object_initializer = true:suggestion
89+
dotnet_style_collection_initializer = true:suggestion
90+
dotnet_style_explicit_tuple_names = true:suggestion
91+
dotnet_style_coalesce_expression = true:suggestion
92+
dotnet_style_null_propagation = true:suggestion
93+
94+
# Expression-bodied members
95+
csharp_style_expression_bodied_methods = false:none
96+
csharp_style_expression_bodied_constructors = false:none
97+
csharp_style_expression_bodied_operators = false:none
98+
csharp_style_expression_bodied_properties = true:none
99+
csharp_style_expression_bodied_indexers = true:none
100+
csharp_style_expression_bodied_accessors = true:none
101+
102+
# Pattern matching
103+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
104+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
105+
csharp_style_inlined_variable_declaration = true:suggestion
106+
107+
# Null checking preferences
108+
csharp_style_throw_expression = true:suggestion
109+
csharp_style_conditional_delegate_call = true:suggestion
110+
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+
# Xml project files
136+
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
137+
indent_size = 2
138+
139+
# Xml build files
140+
[*.builds]
141+
indent_size = 2
142+
143+
# Xml files
144+
[*.{xml,stylecop,resx,ruleset}]
145+
indent_size = 2
146+
147+
# Xml config files
148+
[*.{props,targets,config,nuspec}]
149+
indent_size = 2
150+
151+
# Shell scripts
152+
[*.sh]
153+
end_of_line = lf
154+
[*.{cmd, bat}]
155+
end_of_line = crlf
156+
157+
# Analyzers
158+
dotnet_code_quality.ca1802.api_surface = private, internal

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ bld/
2929
[Bb]in/
3030
[Oo]bj/
3131
[Ll]og/
32+
.nuget/
3233

3334
# Visual Studio 2015/2017 cache/options directory
3435
.vs/

src/Directory.Build.props

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<TargetsAnyOS Condition="'$(OSGroup)' == 'AnyOS'">true</TargetsAnyOS>
1212
<IsSourceProject Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), 'src%24'))">true</IsSourceProject>
1313
</PropertyGroup>
14-
14+
<PropertyGroup Condition="$(Configuration.Contains('Debug'))">
15+
<DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
16+
</PropertyGroup>
1517
<PropertyGroup>
1618
<ProjectDir>$(MSBuildThisFileDirectory)</ProjectDir>
1719
<RepoRoot>$(ProjectDir)..\</RepoRoot>

src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.Manual.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ public sealed partial class SqlParameter
1919
{
2020
internal class SqlParameterConverter { }
2121
}
22-
}
22+
}

src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.NetCoreApp.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,4 @@ public override void Flush() { }
143143
public override void SetLength(long value) { throw null; }
144144
public override void Write(byte[] buffer, int offset, int count) { throw null; }
145145
}
146-
}
146+
}

src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1081,4 +1081,4 @@ public SensitivityProperty(Microsoft.Data.SqlClient.DataClassification.Label lab
10811081
public Microsoft.Data.SqlClient.DataClassification.InformationType InformationType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
10821082
public Microsoft.Data.SqlClient.DataClassification.Label Label { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
10831083
}
1084-
}
1084+
}

src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/NegotiationInfoClass.cs

+7-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ internal NegotiationInfoClass(SafeHandle safeHandle, int negotiationState)
1616
{
1717
if (safeHandle.IsInvalid)
1818
{
19-
if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"Invalid handle:{safeHandle}");
19+
if (NetEventSource.IsEnabled)
20+
NetEventSource.Info(this, $"Invalid handle:{safeHandle}");
2021
return;
2122
}
2223

2324
IntPtr packageInfo = safeHandle.DangerousGetHandle();
24-
if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"packageInfo:{packageInfo} negotiationState:{negotiationState:x}");
25+
if (NetEventSource.IsEnabled)
26+
NetEventSource.Info(this, $"packageInfo:{packageInfo} negotiationState:{negotiationState:x}");
2527

2628
if (negotiationState == Interop.SspiCli.SECPKG_NEGOTIATION_COMPLETE
2729
|| negotiationState == Interop.SspiCli.SECPKG_NEGOTIATION_OPTIMISTIC)
@@ -30,14 +32,15 @@ internal NegotiationInfoClass(SafeHandle safeHandle, int negotiationState)
3032

3133
unsafe
3234
{
33-
IntPtr unmanagedString = ((SecurityPackageInfo *)packageInfo)->Name;
35+
IntPtr unmanagedString = ((SecurityPackageInfo*)packageInfo)->Name;
3436
if (unmanagedString != IntPtr.Zero)
3537
{
3638
name = Marshal.PtrToStringUni(unmanagedString);
3739
}
3840
}
3941

40-
if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"packageInfo:{packageInfo} negotiationState:{negotiationState:x} name:{name}");
42+
if (NetEventSource.IsEnabled)
43+
NetEventSource.Info(this, $"packageInfo:{packageInfo} negotiationState:{negotiationState:x} name:{name}");
4144

4245
// An optimization for future string comparisons.
4346
if (string.Equals(name, Kerberos, StringComparison.OrdinalIgnoreCase))

src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIAuthType.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public SecurityPackageInfoClass[] SecurityPackages
2727

2828
public int EnumerateSecurityPackages(out int pkgnum, out SafeFreeContextBuffer pkgArray)
2929
{
30-
if (NetEventSource.IsEnabled) NetEventSource.Info(this);
30+
if (NetEventSource.IsEnabled)
31+
NetEventSource.Info(this);
3132
return SafeFreeContextBuffer.EnumeratePackages(out pkgnum, out pkgArray);
3233
}
3334

src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPISecureChannelType.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public SecurityPackageInfoClass[] SecurityPackages
2626

2727
public int EnumerateSecurityPackages(out int pkgnum, out SafeFreeContextBuffer pkgArray)
2828
{
29-
if (NetEventSource.IsEnabled) NetEventSource.Info(this);
29+
if (NetEventSource.IsEnabled)
30+
NetEventSource.Info(this);
3031
return SafeFreeContextBuffer.EnumeratePackages(out pkgnum, out pkgArray);
3132
}
3233

0 commit comments

Comments
 (0)