-
Notifications
You must be signed in to change notification settings - Fork 0
Fix MA0003 and RCS1140 analyzer errors in TransformerBase, LoaderBase, and ExtractorBase #65
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
Changes from all commits
a14c587
baa8565
06cf246
073b31c
934cd39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -433,3 +433,4 @@ docfx_project/obj/ | |
| docs/* | ||
| !docs/.gitkeep | ||
| !docs/RELEASE-WORKFLOW-SETUP.md | ||
| .nuget/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ public abstract class LoaderBase<TDestination, TProgress> | |
| /// <summary> | ||
| /// The number of milliseconds between progress updates. | ||
| /// </summary> | ||
| /// <exception cref="ArgumentException">Value cannot be less than 1</exception> | ||
| /// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 1</exception> | ||
| public int ReportingInterval | ||
| { | ||
| get => _reportingInterval; | ||
|
|
@@ -52,7 +52,7 @@ public int ReportingInterval | |
| /// It is the responsibility of the derived class to keep this value up to date as the | ||
| /// base class will have no way of knowing the correct value | ||
| /// </remarks> | ||
|
|
||
| /// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception> | ||
| [Range(0, int.MaxValue, ErrorMessage = "Current item count cannot be less than 0.")] | ||
| public int CurrentItemCount | ||
| { | ||
|
|
@@ -72,6 +72,7 @@ protected set | |
| /// <summary> | ||
| /// Gets the current number of records skipped | ||
| /// </summary> | ||
| /// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception> | ||
| public int CurrentSkippedItemCount | ||
| { | ||
|
Comment on lines
+75
to
77
|
||
| get => _currentSkippedItemCount; | ||
|
|
@@ -94,7 +95,7 @@ protected set | |
| /// This is useful for partially loading data from a source, especially when the source is large | ||
| /// or infinite or during development. | ||
| /// </remarks> | ||
| /// <exception cref="ArgumentException">The specified value is less than 1</exception> | ||
| /// <exception cref="ArgumentOutOfRangeException">The specified value is less than 1</exception> | ||
|
Chris-Wolfgang marked this conversation as resolved.
|
||
| /// <example> | ||
| /// <code> | ||
| /// foreach (var item in items.Skip(SkipItemCount).Take(MaxItemCount)) | ||
|
|
@@ -109,9 +110,9 @@ public int MaximumItemCount | |
| get => _maximumItemCount; | ||
| set | ||
| { | ||
| if (value < 0) | ||
| if (value < 1) | ||
| { | ||
| throw new ArgumentOutOfRangeException(nameof(value), "Maximum item count cannot be less than 0."); | ||
| throw new ArgumentOutOfRangeException(nameof(value), "Maximum item count cannot be less than 1."); | ||
| } | ||
| _maximumItemCount = value; | ||
| } | ||
|
|
@@ -126,7 +127,7 @@ public int MaximumItemCount | |
| /// <remarks> | ||
| /// This is useful for skipping the beginning of the list during testing or because it may already be loaded | ||
| /// </remarks> | ||
| /// <exception cref="ArgumentException">The specified value is less than 0</exception> | ||
| /// <exception cref="ArgumentOutOfRangeException">The specified value is less than 0</exception> | ||
| /// <example> | ||
| /// <code> | ||
| /// foreach (var item in items.Skip(SkipItemCount).Take(MaxItemCount)) | ||
|
|
@@ -229,7 +230,7 @@ IProgress<TProgress> progress | |
| using var timer = new Timer | ||
| ( | ||
| _ => progress.Report(CreateProgressReport()), | ||
| null, | ||
| state: null, | ||
| TimeSpan.Zero, | ||
| TimeSpan.FromMilliseconds(ReportingInterval) | ||
| ); | ||
|
|
@@ -271,7 +272,7 @@ CancellationToken token | |
| using var timer = new Timer | ||
| ( | ||
| _ => progress.Report(CreateProgressReport()), | ||
| null, | ||
| state: null, | ||
| TimeSpan.Zero, | ||
| TimeSpan.FromMilliseconds(ReportingInterval) | ||
| ); | ||
|
|
@@ -336,4 +337,4 @@ protected void IncrementCurrentSkippedItemCount() | |
| Interlocked.Increment(ref _currentSkippedItemCount); | ||
| } | ||
|
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ public abstract class TransformerBase<TSource, TDestination, TProgress> | |
| /// <summary> | ||
| /// The number of milliseconds between progress updates. | ||
| /// </summary> | ||
| /// <exception cref="ArgumentException">Value cannot be less than 1</exception> | ||
| /// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 1</exception> | ||
| public int ReportingInterval | ||
| { | ||
| get => _reportingInterval; | ||
|
|
@@ -51,7 +51,7 @@ public int ReportingInterval | |
| /// It is the responsibility of the derived class to keep this value up to date as the | ||
| /// base class will have no way of knowing the correct value | ||
| /// </remarks> | ||
|
|
||
| /// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception> | ||
| [Range(0, int.MaxValue, ErrorMessage = "Current item count cannot be less than 0.")] | ||
| public int CurrentItemCount | ||
| { | ||
|
|
@@ -71,6 +71,7 @@ protected set | |
| /// <summary> | ||
| /// Gets the current number of records skipped | ||
| /// </summary> | ||
| /// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception> | ||
| public int CurrentSkippedItemCount | ||
| { | ||
|
Comment on lines
+74
to
76
|
||
| get => _currentSkippedItemCount; | ||
|
|
@@ -93,7 +94,7 @@ protected set | |
| /// This is useful for transforming a subset of data, especially when the source is large | ||
| /// or infinite or during development. | ||
| /// </remarks> | ||
| /// <exception cref="ArgumentException">The specified value is less than 1</exception> | ||
| /// <exception cref="ArgumentOutOfRangeException">The specified value is less than 1</exception> | ||
| /// <example> | ||
| /// <code> | ||
|
Chris-Wolfgang marked this conversation as resolved.
|
||
| /// foreach (var item in items.Skip(SkipItemCount).Take(MaxItemCount)) | ||
|
|
@@ -108,9 +109,9 @@ public int MaximumItemCount | |
| get => _maximumItemCount; | ||
| set | ||
| { | ||
| if (value < 0) | ||
| if (value < 1) | ||
| { | ||
| throw new ArgumentOutOfRangeException(nameof(value), "Maximum item count cannot be less than 0."); | ||
| throw new ArgumentOutOfRangeException(nameof(value), "Maximum item count cannot be less than 1."); | ||
| } | ||
| _maximumItemCount = value; | ||
| } | ||
|
|
@@ -126,7 +127,7 @@ public int MaximumItemCount | |
| /// This is useful for transforming a subset of data, especially when the source is large | ||
| /// or infinite or during development. | ||
| /// </remarks> | ||
| /// <exception cref="ArgumentException">The specified value is less than 0</exception> | ||
| /// <exception cref="ArgumentOutOfRangeException">The specified value is less than 0</exception> | ||
| /// <example> | ||
| /// <code> | ||
| /// foreach (var item in items.Skip(SkipItemCount).Take(MaxItemCount)) | ||
|
|
@@ -159,6 +160,7 @@ public int SkipItemCount | |
| /// IAsyncEnumerable<T> | ||
| /// The result may be an empty sequence if no data is available or if the transformation fails. | ||
| /// </returns> | ||
| /// <exception cref="ArgumentNullException">The value of items is null</exception> | ||
| public virtual IAsyncEnumerable<TDestination> TransformAsync | ||
| ( | ||
| IAsyncEnumerable<TSource> items | ||
|
|
@@ -184,6 +186,7 @@ IAsyncEnumerable<TSource> items | |
| /// </returns> | ||
| /// <remarks> | ||
| /// </remarks> | ||
| /// <exception cref="ArgumentNullException">The value of items is null</exception> | ||
| public virtual IAsyncEnumerable<TDestination> TransformAsync | ||
| ( | ||
| IAsyncEnumerable<TSource> items, | ||
|
|
@@ -226,7 +229,7 @@ IProgress<TProgress> progress | |
| using var timer = new Timer | ||
| ( | ||
| _ => progress.Report(CreateProgressReport()), | ||
| null, | ||
| state: null, | ||
| TimeSpan.Zero, | ||
| TimeSpan.FromMilliseconds(ReportingInterval) | ||
| ); | ||
|
|
@@ -270,7 +273,7 @@ CancellationToken token | |
| using var timer = new Timer | ||
| ( | ||
| _ => progress.Report(CreateProgressReport()), | ||
| null, | ||
| state: null, | ||
| TimeSpan.Zero, | ||
| TimeSpan.FromMilliseconds(ReportingInterval) | ||
| ); | ||
|
|
@@ -335,4 +338,4 @@ protected void IncrementCurrentSkippedItemCount() | |
| Interlocked.Increment(ref _currentSkippedItemCount); | ||
| } | ||
|
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CurrentSkippedItemCount's setter validates the input but never assigns the value to_currentSkippedItemCount, making the setter a no-op for derived classes. Assign_currentSkippedItemCount = valueafter the range check (consistent withCurrentItemCount).