Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Naming standardization #1273

Merged
merged 30 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bd696c0
refactor: use `IndexOf` instead of `GetIndex`
DaveSkender Nov 11, 2024
53f869d
rename test file
DaveSkender Nov 12, 2024
6deee05
Merge branch 'v3' into v3-refactor-naming
DaveSkender Nov 16, 2024
18dccd0
drop unneeded signing
DaveSkender Nov 16, 2024
26af67b
add static indicator aliases
DaveSkender Nov 18, 2024
443cacb
fix: Private init AdxList prop
DaveSkender Nov 21, 2024
440fc5b
refactor: reorg simulation project
DaveSkender Nov 25, 2024
97b4345
Merge branch 'v3-refactor-naming' of https://github.com/DaveSkender/S…
DaveSkender Nov 25, 2024
bcc2e11
Merge branch 'v3' into v3-refactor-naming
DaveSkender Nov 27, 2024
5ae4793
Delete tests/external/application/_testdata directory
DaveSkender Nov 28, 2024
b947280
fix misc v2.x references
DaveSkender Nov 28, 2024
2a515a6
Merge branch 'v3-refactor-naming' of https://github.com/DaveSkender/S…
DaveSkender Nov 28, 2024
3dd0189
initial batch of all time-series indicators
DaveSkender Nov 28, 2024
b609e49
Add `[Obsolete]` attribute to `Quote` class's `Date` property
DaveSkender Nov 29, 2024
bd901fa
update Date obsolete note
DaveSkender Nov 29, 2024
61f692e
Merge branch 'v3-refactor-naming' of https://github.com/DaveSkender/S…
DaveSkender Nov 29, 2024
454825f
remove superfluous obsoletion tests
DaveSkender Nov 29, 2024
bd8b001
Merge branch 'v3' into v3-refactor-naming
DaveSkender Nov 29, 2024
0882f61
code cleanup
DaveSkender Nov 29, 2024
2d74f1f
simplify sim proj data file refs
DaveSkender Nov 29, 2024
a40d178
move obsolete indicator items together
DaveSkender Nov 29, 2024
3d2a78c
Merge branch 'v3' into v3-refactor-naming
DaveSkender Nov 29, 2024
5de8276
add tuples-based indicators to runner app
DaveSkender Nov 30, 2024
972898f
Merge branch 'v3-refactor-naming' of https://github.com/DaveSkender/S…
DaveSkender Nov 30, 2024
73c6c90
add utility migration scenarios
DaveSkender Dec 1, 2024
bcb070d
add missing cases to test application
DaveSkender Dec 1, 2024
e4a7064
add [obsolete] attributes to tuple-based indicators
DaveSkender Dec 1, 2024
453f3f3
add obolete utility migrations
DaveSkender Dec 1, 2024
d2679ba
Update v3 migration guide in `ObsoleteV3.md`
DaveSkender Dec 1, 2024
4bfda9a
tweaks to migration guide
DaveSkender Dec 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 66 additions & 29 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,34 +1,67 @@
# top-most EditorConfig file
# EditorConfig: https://EditorConfig.org

# Top-level EditorConfig file
root = true

#### Core EditorConfig Options ####

# Global settings for all files
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

indent_style = space
indent_size = 2
tab_width = 2

line_length = 150
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 150

# .NET Globals
[*.cs]
#### File Type Overrides ####

# Markdown files
[*.md]

# Allow trailing whitespace for line breaks
trim_trailing_whitespace = false

# Batch and command files
[*.{cmd,bat}]

# Use CRLF for Windows specific files
end_of_line = crlf

# .NET source files
[*.{cs,vb}]

# set indentation to 4 spaces
indent_size = 4
tab_width = 4

#### .NET Coding Conventions ####
# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/overview
# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/

# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = true
# File headers are disabled
file_header_template = unset

# Organize 'using' directives
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false

# Simplify type names and remove unnecessary qualifiers
dotnet_diagnostic.IDE0001.severity = warning # Simplify type names
dotnet_style_qualification_for_field = false:warning # Prefer 'field' over 'this.field'
dotnet_style_qualification_for_property = false:warning # Prefer 'property' over 'this.property'
dotnet_style_qualification_for_method = false:warning # Prefer 'method()' over 'this.method()'
dotnet_style_qualification_for_event = false:warning # Prefer 'event' over 'this.event'

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning # Require modifiers except for interface members

# Ensure space around colon in named arguments
dotnet_style_space_around_colon_in_named_argument = true:suggestion
dotnet_diagnostic.IDE0040.severity = suggestion

# Expression-level preferences
dotnet_style_coalesce_expression = true:suggestion
Expand All @@ -38,19 +71,21 @@ dotnet_style_namespace_match_folder = false:none
dotnet_style_null_propagation = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_compound_assignment = true
dotnet_style_prefer_conditional_expression_over_assignment = true
dotnet_style_prefer_conditional_expression_over_return = true
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
dotnet_style_prefer_inferred_anonymous_type_member_names = true
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true
dotnet_style_prefer_simplified_interpolation = true
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion # Prefer 'int' over 'Int32'

# Collection expression preferences
dotnet_style_prefer_collection_expression = true:suggestion
dotnet_diagnostic.IDE0305.severity = none # exclude collection expression for fluent
dotnet_diagnostic.IDE0305.severity = none # Exclude collection expression for fluent APIs

csharp_space_between_square_brackets = false
csharp_space_between_empty_square_brackets = false

Expand Down Expand Up @@ -87,13 +122,21 @@ dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_code_quality_explicit_tuple_names = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion

# Diagnostic analyzer suppressions
dotnet_diagnostic.IDE0058.severity = none # Unused expression value, use _ discard variable

# remove this when no-longer supporting pre-9.0 frameworks
dotnet_diagnostic.IDE0330.severity = none # Prefer 'System.Threading.Lock'

#### C# Coding Conventions ####
# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options

[*.cs]

# var preferences
csharp_style_var_elsewhere = false
csharp_style_var_for_built_in_types = false
csharp_style_var_when_type_is_apparent = false
csharp_style_var_elsewhere = false # Do not prefer 'var' elsewhere
csharp_style_var_for_built_in_types = false # Do not prefer 'var' for built-in types
csharp_style_var_when_type_is_apparent = false # Do not prefer 'var' when type is apparent

# Labeling and using directives
csharp_indent_labels = one_less_than_current
Expand Down Expand Up @@ -147,9 +190,3 @@ csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_members_in_anonymous_types = false
csharp_new_line_between_query_expression_clauses = false

# Diagnostic analyzer suppressions
dotnet_diagnostic.IDE0058.severity = none # Unused expression value, use _ discard variable

# remove this when no-longer supporting pre-9.0 frameworks
dotnet_diagnostic.IDE0330.severity = none # Prefer 'System.Threading.Lock'
10 changes: 0 additions & 10 deletions src/Directory.Packages.props

This file was deleted.

7 changes: 4 additions & 3 deletions src/Indicators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageProjectUrl>https://dotnet.stockindicators.dev</PackageProjectUrl>
<PackageId>Skender.Stock.Indicators</PackageId>
<PackageTags>
Stock;Market;Indicators;Technical;Analysis;Algorithmic;Trading;Trade;Finance;
Stock;Market;Indicators;Technical;Analysis;Algorithmic;Trading;Trade;Finance;
</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
Expand All @@ -43,7 +43,8 @@
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<SignAssembly>true</SignAssembly>
<NoWarn>$(NoWarn);NU1507</NoWarn>

</PropertyGroup>

<ItemGroup>
Expand All @@ -66,7 +67,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions src/_common/Observables/StreamHub.Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static bool TryFindIndex<T>(
out int index)
where T : ISeries
{
index = cache.GetIndex(timestamp, false);
index = cache.IndexOf(timestamp, false);
return index != -1;
}

Expand All @@ -32,7 +32,7 @@ internal static bool TryFindIndex<T>(
/// <param name="throwOnFail">Throw exception when item is not found.</param>
/// <returns>Index position.</returns>
/// <exception cref="ArgumentException">When item is not found (should never happen).</exception>
internal static int GetIndex<T>(
internal static int IndexOf<T>(
this IReadOnlyList<T> cache,
T cachedItem,
bool throwOnFail)
Expand Down Expand Up @@ -105,15 +105,15 @@ internal static int GetIndex<T>(
/// <remarks>
/// Only use this when you are looking for a point in time
/// without a matching item for context. In most cases
/// <see cref="GetIndex{T}(IReadOnlyList{T},T,bool)"/> is more appropriate.
/// <see cref="IndexOf{T}(IReadOnlyList{T},T,bool)"/> is more appropriate.
/// </remarks>
/// <typeparam name="T">Type of the items in the cache, must implement ISeries.</typeparam>
/// <param name="cache">The cache to search.</param>
/// <param name="timestamp">Timestamp of cached item.</param>
/// <param name="throwOnFail">Throw exception when timestamp is not found.</param>
/// <returns>Index position.</returns>
/// <exception cref="ArgumentException">When timestamp is not found (should never happen).</exception>
internal static int GetIndex<T>(
internal static int IndexOf<T>(
this IReadOnlyList<T> cache,
DateTime timestamp,
bool throwOnFail)
Expand Down Expand Up @@ -154,13 +154,13 @@ internal static int GetIndex<T>(
/// <remarks>
/// Only use this when you are looking for a point in time
/// without a matching item for context. In most cases
/// <see cref="GetIndex{T}(IReadOnlyList{T},T,bool)"/> is more appropriate.
/// <see cref="IndexOf{T}(IReadOnlyList{T},T,bool)"/> is more appropriate.
/// </remarks>
/// <typeparam name="T">Type of the items in the cache, must implement ISeries.</typeparam>
/// <param name="cache">The cache to search.</param>
/// <param name="timestamp">Timestamp of cached item.</param>
/// <returns>First index position or -1 if not found.</returns>
internal static int GetIndexGte<T>(
internal static int IndexGte<T>(
this IReadOnlyList<T> cache,
DateTime timestamp)
where T : ISeries
Expand Down
2 changes: 1 addition & 1 deletion src/_common/Observables/StreamHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public void Rebuild(DateTime fromTimestamp)
RemoveRange(fromTimestamp, notify: false);

// get provider position
int provIndex = ProviderCache.GetIndexGte(fromTimestamp);
int provIndex = ProviderCache.IndexGte(fromTimestamp);

// rebuild
if (provIndex >= 0)
Expand Down
Loading