Skip to content

Commit 2a61137

Browse files
committed
ran dotnet format
1 parent 27ccce1 commit 2a61137

File tree

57 files changed

+3117
-2575
lines changed

Some content is hidden

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

57 files changed

+3117
-2575
lines changed

.editorconfig

Lines changed: 166 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,193 @@
1-
# EditorConfig is awesome:http://EditorConfig.org
1+
# editorconfig.org (https://github.com/dotnet/runtime/blob/main/.editorconfig)
22

33
# top-most EditorConfig file
44
root = true
55

6-
# Don't use tabs for indentation.
6+
# Default settings:
7+
# A newline ending every file
8+
# Use 4 spaces as indentation
79
[*]
10+
insert_final_newline = true
811
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}]
1312
indent_size = 4
13+
trim_trailing_whitespace = true
1414

15-
# Xml project files
16-
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
17-
indent_size = 2
15+
[*.json]
16+
insert_final_newline = false
1817

19-
# Xml config files
20-
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
21-
indent_size = 2
18+
# Generated code
19+
[*{_AssemblyInfo.cs,.notsupported.cs,AsmOffsets.cs}]
20+
generated_code = true
2221

23-
# JSON files
24-
[*.json]
25-
indent_size = 2
22+
# C# files
23+
[*.cs]
24+
# New line preferences
25+
csharp_new_line_before_open_brace = all
26+
csharp_new_line_before_else = true
27+
csharp_new_line_before_catch = true
28+
csharp_new_line_before_finally = true
29+
csharp_new_line_before_members_in_object_initializers = true
30+
csharp_new_line_before_members_in_anonymous_types = true
31+
csharp_new_line_between_query_expression_clauses = true
2632

27-
# Dotnet code style settings:
28-
[*.{cs, vb}]
29-
# Sort using and Import directives with System.* appearing first
30-
dotnet_sort_system_directives_first = true
31-
# Avoid "this." and "Me." if not necessary
32-
dotnet_style_qualification_for_field = false:suggestion
33-
dotnet_style_qualification_for_property = false:suggestion
34-
dotnet_style_qualification_for_method = false:suggestion
35-
dotnet_style_qualification_for_event = false:suggestion
33+
# Indentation preferences
34+
csharp_indent_block_contents = true
35+
csharp_indent_braces = false
36+
csharp_indent_case_contents = true
37+
csharp_indent_case_contents_when_block = true
38+
csharp_indent_switch_labels = true
39+
csharp_indent_labels = one_less_than_current
40+
41+
# Modifier preferences
42+
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
3643

37-
# Use language keywords instead of framework type names for type references
44+
# avoid this. unless absolutely necessary
45+
dotnet_style_qualification_for_field = false:error
46+
dotnet_style_qualification_for_property = false:error
47+
dotnet_style_qualification_for_method = false:error
48+
dotnet_style_qualification_for_event = false:error
49+
50+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
51+
csharp_style_var_for_built_in_types = false:suggestion
52+
csharp_style_var_when_type_is_apparent = false:none
53+
csharp_style_var_elsewhere = true:suggestion
3854
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
3955
dotnet_style_predefined_type_for_member_access = false:suggestion
4056

41-
# Suggest more modern language features when available
57+
# name all constant fields using PascalCase
58+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
59+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
60+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
61+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
62+
dotnet_naming_symbols.constant_fields.required_modifiers = const
63+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
64+
65+
# static fields should have s_ prefix
66+
dotnet_naming_rule.static_fields_should_have_prefix.severity = false:none
67+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
68+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
69+
dotnet_naming_symbols.static_fields.applicable_kinds = field
70+
dotnet_naming_symbols.static_fields.required_modifiers = static
71+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
72+
dotnet_naming_style.static_prefix_style.required_prefix = s_
73+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
74+
75+
# internal and private fields should be _camelCase
76+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
77+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
78+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
79+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
80+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
81+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
82+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
83+
84+
# Code style defaults
85+
csharp_using_directive_placement = outside_namespace:suggestion
86+
dotnet_sort_system_directives_first = true
87+
csharp_prefer_braces = true:silent
88+
csharp_preserve_single_line_blocks = true:none
89+
csharp_preserve_single_line_statements = false:none
90+
csharp_prefer_static_local_function = true:suggestion
91+
csharp_prefer_simple_using_statement = false:none
92+
csharp_style_prefer_switch_expression = true:suggestion
93+
dotnet_style_readonly_field = true:suggestion
94+
95+
# Expression-level preferences
4296
dotnet_style_object_initializer = true:suggestion
4397
dotnet_style_collection_initializer = true:suggestion
98+
dotnet_style_explicit_tuple_names = true:suggestion
4499
dotnet_style_coalesce_expression = true:suggestion
45100
dotnet_style_null_propagation = true:suggestion
46-
dotnet_style_explicit_tuple_names = true:suggestion
47-
48-
# CSharp code style settings:
49-
[*.cs]
50-
# Prefer "var" everywhere
51-
csharp_style_var_for_built_in_types = false:suggestion
52-
csharp_style_var_when_type_is_apparent = true:suggestion
53-
csharp_style_var_elsewhere = true:suggestion
101+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
102+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
103+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
104+
dotnet_style_prefer_auto_properties = true:suggestion
105+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
106+
dotnet_style_prefer_conditional_expression_over_return = true:silent
107+
csharp_prefer_simple_default_expression = true:suggestion
54108

55-
# Prefer method-like constructs to have a block body
56-
csharp_style_expression_bodied_methods = false:none
57-
csharp_style_expression_bodied_constructors = false:none
58-
csharp_style_expression_bodied_operators = false:none
109+
# Expression-bodied members
110+
csharp_style_expression_bodied_methods = true:silent
111+
csharp_style_expression_bodied_constructors = true:silent
112+
csharp_style_expression_bodied_operators = true:silent
113+
csharp_style_expression_bodied_properties = true:silent
114+
csharp_style_expression_bodied_indexers = true:silent
115+
csharp_style_expression_bodied_accessors = true:silent
116+
csharp_style_expression_bodied_lambdas = true:silent
117+
csharp_style_expression_bodied_local_functions = true:silent
59118

60-
# Prefer property-like constructs to have an expression-body
61-
csharp_style_expression_bodied_properties = true:none
62-
csharp_style_expression_bodied_indexers = true:none
63-
csharp_style_expression_bodied_accessors = true:none
64-
65-
# Suggest more modern language features when available
119+
# Pattern matching
66120
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
67121
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
68122
csharp_style_inlined_variable_declaration = true:suggestion
123+
124+
# Null checking preferences
69125
csharp_style_throw_expression = true:suggestion
70126
csharp_style_conditional_delegate_call = true:suggestion
71127

72-
# Newline settings
73-
csharp_new_line_before_open_brace = false:error
74-
csharp_new_line_before_else = false:error
75-
csharp_new_line_before_catch = false:error
76-
csharp_new_line_before_finally = false:error
77-
csharp_new_line_before_members_in_object_initializers = false:error
78-
csharp_new_line_before_members_in_anonymous_types = false:error
128+
# Other features
129+
csharp_style_prefer_index_operator = false:none
130+
csharp_style_prefer_range_operator = false:none
131+
csharp_style_pattern_local_over_anonymous_function = false:none
132+
133+
# Space preferences
134+
csharp_space_after_cast = false
135+
csharp_space_after_colon_in_inheritance_clause = true
136+
csharp_space_after_comma = true
137+
csharp_space_after_dot = false
138+
csharp_space_after_keywords_in_control_flow_statements = true
139+
csharp_space_after_semicolon_in_for_statement = true
140+
csharp_space_around_binary_operators = before_and_after
141+
csharp_space_around_declaration_statements = do_not_ignore
142+
csharp_space_before_colon_in_inheritance_clause = true
143+
csharp_space_before_comma = false
144+
csharp_space_before_dot = false
145+
csharp_space_before_open_square_brackets = false
146+
csharp_space_before_semicolon_in_for_statement = false
147+
csharp_space_between_empty_square_brackets = false
148+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
149+
csharp_space_between_method_call_name_and_opening_parenthesis = false
150+
csharp_space_between_method_call_parameter_list_parentheses = false
151+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
152+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
153+
csharp_space_between_method_declaration_parameter_list_parentheses = false
154+
csharp_space_between_parentheses = false
155+
csharp_space_between_square_brackets = false
156+
157+
# Custom
158+
csharp_style_namespace_declarations = file_scoped:error
159+
dotnet_diagnostic.IDE0005.severity = error # Using directive is unnecessary.
160+
161+
# C++ Files
162+
[*.{cpp,h,in}]
163+
curly_bracket_next_line = true
164+
indent_brace_style = Allman
165+
166+
# Xml project files
167+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
168+
indent_size = 2
169+
170+
[*.{csproj,vbproj,proj,nativeproj,locproj}]
171+
charset = utf-8
172+
173+
# Xml build files
174+
[*.builds]
175+
indent_size = 2
176+
177+
# Xml files
178+
[*.{xml,stylecop,resx,ruleset}]
179+
indent_size = 2
180+
181+
# Xml config files
182+
[*.{props,targets,config,nuspec}]
183+
indent_size = 2
184+
185+
# YAML config files
186+
[*.{yml,yaml}]
187+
indent_size = 2
188+
189+
# Shell scripts
190+
[*.sh]
191+
end_of_line = lf
192+
[*.{cmd,bat}]
193+
end_of_line = crlf
Lines changed: 66 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,83 @@
11
using System;
22
using System.Diagnostics;
33

4-
namespace Exceptionless.DateTimeExtensions {
4+
namespace Exceptionless.DateTimeExtensions;
5+
6+
/// <summary>
7+
/// A class defining a business day.
8+
/// </summary>
9+
[DebuggerDisplay("DayOfWeek={DayOfWeek}, StartTime={StartTime}, EndTime={EndTime}")]
10+
public class BusinessDay
11+
{
512
/// <summary>
6-
/// A class defining a business day.
13+
/// Initializes a new instance of the <see cref="BusinessDay"/> class.
714
/// </summary>
8-
[DebuggerDisplay("DayOfWeek={DayOfWeek}, StartTime={StartTime}, EndTime={EndTime}")]
9-
public class BusinessDay {
10-
/// <summary>
11-
/// Initializes a new instance of the <see cref="BusinessDay"/> class.
12-
/// </summary>
13-
/// <param name="dayOfWeek">The day of week this business day represents.</param>
14-
public BusinessDay(DayOfWeek dayOfWeek) {
15-
StartTime = TimeSpan.FromHours(9); // 9am
16-
EndTime = TimeSpan.FromHours(17); // 5pm
17-
DayOfWeek = dayOfWeek;
18-
}
15+
/// <param name="dayOfWeek">The day of week this business day represents.</param>
16+
public BusinessDay(DayOfWeek dayOfWeek)
17+
{
18+
StartTime = TimeSpan.FromHours(9); // 9am
19+
EndTime = TimeSpan.FromHours(17); // 5pm
20+
DayOfWeek = dayOfWeek;
21+
}
1922

20-
/// <summary>
21-
/// Initializes a new instance of the <see cref="BusinessDay"/> class.
22-
/// </summary>
23-
/// <param name="dayOfWeek">The day of week this business day represents.</param>
24-
/// <param name="startTime">The start time of the business day.</param>
25-
/// <param name="endTime">The end time of the business day.</param>
26-
public BusinessDay(DayOfWeek dayOfWeek, TimeSpan startTime, TimeSpan endTime) {
27-
if (startTime.TotalDays >= 1)
28-
throw new ArgumentOutOfRangeException(nameof(startTime), startTime, "The startTime argument must be less then one day.");
23+
/// <summary>
24+
/// Initializes a new instance of the <see cref="BusinessDay"/> class.
25+
/// </summary>
26+
/// <param name="dayOfWeek">The day of week this business day represents.</param>
27+
/// <param name="startTime">The start time of the business day.</param>
28+
/// <param name="endTime">The end time of the business day.</param>
29+
public BusinessDay(DayOfWeek dayOfWeek, TimeSpan startTime, TimeSpan endTime)
30+
{
31+
if (startTime.TotalDays >= 1)
32+
throw new ArgumentOutOfRangeException(nameof(startTime), startTime, "The startTime argument must be less then one day.");
2933

30-
if (endTime.TotalDays > 1)
31-
throw new ArgumentOutOfRangeException(nameof(endTime), endTime, "The endTime argument must be less then one day.");
34+
if (endTime.TotalDays > 1)
35+
throw new ArgumentOutOfRangeException(nameof(endTime), endTime, "The endTime argument must be less then one day.");
3236

33-
if (endTime <= startTime)
34-
throw new ArgumentOutOfRangeException(nameof(endTime), endTime, "The endTime argument must be greater then startTime.");
37+
if (endTime <= startTime)
38+
throw new ArgumentOutOfRangeException(nameof(endTime), endTime, "The endTime argument must be greater then startTime.");
3539

36-
DayOfWeek = dayOfWeek;
37-
StartTime = startTime;
38-
EndTime = endTime;
39-
}
40+
DayOfWeek = dayOfWeek;
41+
StartTime = startTime;
42+
EndTime = endTime;
43+
}
4044

41-
/// <summary>
42-
/// Gets the day of week this business day represents..
43-
/// </summary>
44-
/// <value>The day of week.</value>
45-
public DayOfWeek DayOfWeek { get; private set; }
45+
/// <summary>
46+
/// Gets the day of week this business day represents..
47+
/// </summary>
48+
/// <value>The day of week.</value>
49+
public DayOfWeek DayOfWeek { get; private set; }
4650

47-
/// <summary>
48-
/// Gets the start time of the business day.
49-
/// </summary>
50-
/// <value>The start time of the business day.</value>
51-
public TimeSpan StartTime { get; private set; }
51+
/// <summary>
52+
/// Gets the start time of the business day.
53+
/// </summary>
54+
/// <value>The start time of the business day.</value>
55+
public TimeSpan StartTime { get; private set; }
5256

53-
/// <summary>
54-
/// Gets the end time of the business day.
55-
/// </summary>
56-
/// <value>The end time of the business day.</value>
57-
public TimeSpan EndTime { get; private set; }
57+
/// <summary>
58+
/// Gets the end time of the business day.
59+
/// </summary>
60+
/// <value>The end time of the business day.</value>
61+
public TimeSpan EndTime { get; private set; }
5862

59-
/// <summary>
60-
/// Determines whether the specified date falls in the business day.
61-
/// </summary>
62-
/// <param name="date">The date to check.</param>
63-
/// <returns>
64-
/// <c>true</c> if the specified date falls in the business day; otherwise, <c>false</c>.
65-
/// </returns>
66-
public bool IsBusinessDay(DateTime date) {
67-
if (date.DayOfWeek != DayOfWeek)
68-
return false;
63+
/// <summary>
64+
/// Determines whether the specified date falls in the business day.
65+
/// </summary>
66+
/// <param name="date">The date to check.</param>
67+
/// <returns>
68+
/// <c>true</c> if the specified date falls in the business day; otherwise, <c>false</c>.
69+
/// </returns>
70+
public bool IsBusinessDay(DateTime date)
71+
{
72+
if (date.DayOfWeek != DayOfWeek)
73+
return false;
6974

70-
if (date.TimeOfDay < StartTime)
71-
return false;
75+
if (date.TimeOfDay < StartTime)
76+
return false;
7277

73-
if (date.TimeOfDay > EndTime)
74-
return false;
78+
if (date.TimeOfDay > EndTime)
79+
return false;
7580

76-
return true;
77-
}
81+
return true;
7882
}
79-
}
83+
}

0 commit comments

Comments
 (0)