Fix MA0003 and RCS1140 analyzer errors in TransformerBase, LoaderBase, and ExtractorBase#65
Conversation
…, and ExtractorBase Co-authored-by: Chris-Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
Co-authored-by: Chris-Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses CI failures caused by analyzer warnings treated as errors by updating ETL abstraction base classes to satisfy MA0003 (named arguments for null in Timer constructors) and RCS1140 (missing/incorrect XML <exception> documentation).
Changes:
- Updated
Timerinstantiations to name thestateargument (state: null) to satisfy MA0003. - Added/adjusted XML
<exception>tags (notablyArgumentOutOfRangeExceptionandArgumentNullException) to satisfy RCS1140. - Updated
.gitignoreto ignore the.nuget/directory.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Wolfgang.Etl.Abstractions/TransformerBase.cs | Adds named Timer arguments and updates exception XML docs on public/protected APIs. |
| src/Wolfgang.Etl.Abstractions/LoaderBase.cs | Adds named Timer arguments and updates exception XML docs on public/protected APIs. |
| src/Wolfgang.Etl.Abstractions/ExtractorBase.cs | Adds named Timer arguments and updates exception XML docs on public/protected APIs. |
| .gitignore | Ignores .nuget/ folder. |
Comments suppressed due to low confidence (3)
src/Wolfgang.Etl.Abstractions/LoaderBase.cs:79
CurrentSkippedItemCount's setter throws on negative values but never assigns the backing field (_currentSkippedItemCount). This makes the setter ineffective for derived classes attempting to update the value. Assign the backing field after validation (or remove the setter if updates are intended to happen only viaIncrementCurrentSkippedItemCount).
/// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception>
public int CurrentSkippedItemCount
{
get => _currentSkippedItemCount;
protected set
src/Wolfgang.Etl.Abstractions/ExtractorBase.cs:77
CurrentSkippedItemCount's setter validatesvaluebut never assigns_currentSkippedItemCount. This means consumers/derived classes can't update the current skipped count via the setter. Assign the backing field after validation (or remove the setter if the count is intended to only be mutated via the increment helper).
/// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception>
public int CurrentSkippedItemCount
{
get => _currentSkippedItemCount;
protected set
src/Wolfgang.Etl.Abstractions/TransformerBase.cs:78
CurrentSkippedItemCount's setter throws on negative values but never assigns the backing field (_currentSkippedItemCount). As a result, derived classes cannot update this value via the setter and the property will remain unchanged unless updated through other means. Assign the backing field after validation (or remove the setter if the value is intended to be read-only except via the increment helper).
/// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception>
public int CurrentSkippedItemCount
{
get => _currentSkippedItemCount;
protected set
| /// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception> | ||
| public int CurrentSkippedItemCount | ||
| { |
There was a problem hiding this comment.
CurrentSkippedItemCount's setter validates the input but never assigns the value to _currentSkippedItemCount (the setter body only throws on negative values). This makes the setter effectively a no-op for derived classes and is inconsistent with CurrentItemCount. Assign _currentSkippedItemCount = value after the range check.
| /// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception> | ||
| public int CurrentSkippedItemCount | ||
| { |
There was a problem hiding this comment.
CurrentSkippedItemCount's setter validates the input but never assigns the value to _currentSkippedItemCount, so derived classes can't set this property (it only changes via IncrementCurrentSkippedItemCount). Assign _currentSkippedItemCount = value after validation, matching CurrentItemCount's setter.
| /// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception> | ||
| public int CurrentSkippedItemCount | ||
| { |
There was a problem hiding this comment.
CurrentSkippedItemCount's setter validates the input but never assigns the value to _currentSkippedItemCount, making the setter a no-op for derived classes. Assign _currentSkippedItemCount = value after the range check (consistent with CurrentItemCount).
e0a1802
into
Upgrade-newest-standards
Release builds treat warnings as errors; 23 analyzer violations in the three base classes were causing CI failures.
Description
Two categories of violations fixed across
TransformerBase.cs,LoaderBase.cs, andExtractorBase.cs:MA0003 — Unnamed
nullargument inTimerconstructorThe
stateparameter was passed as a positionalnullin all 6Timerinstantiations. Fixed with named argument syntax:RCS1140 — Missing or incorrect
<exception>XML doc tagsArgumentException→ArgumentOutOfRangeException) onReportingInterval,MaximumItemCount, andSkipItemCountsetters in all three classesCurrentItemCountandCurrentSkippedItemCountsetters in all three classesArgumentNullExceptiontags onTransformAsync(items)andTransformAsync(items, token)inTransformerBaseType of change
How Has This Been Tested?
Checklist
Screenshots (if applicable)
N/A
Additional context
TreatWarningsAsErrorsis enabled for Release configuration inDirectory.Build.props, so these were hard build failures in CI despite being flagged as "warnings" by the analyzer rules.Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.