Skip to content

Fix MA0003 and RCS1140 analyzer errors in TransformerBase, LoaderBase, and ExtractorBase#65

Merged
Chris-Wolfgang merged 5 commits intoUpgrade-newest-standardsfrom
copilot/fix-analyzer-errors-in-abstractions
Mar 9, 2026
Merged

Fix MA0003 and RCS1140 analyzer errors in TransformerBase, LoaderBase, and ExtractorBase#65
Chris-Wolfgang merged 5 commits intoUpgrade-newest-standardsfrom
copilot/fix-analyzer-errors-in-abstractions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 9, 2026

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, and ExtractorBase.cs:

MA0003 — Unnamed null argument in Timer constructor

The state parameter was passed as a positional null in all 6 Timer instantiations. Fixed with named argument syntax:

// Before
new Timer(_ => progress.Report(CreateProgressReport()), null, TimeSpan.Zero, ...)

// After
new Timer(_ => progress.Report(CreateProgressReport()), state: null, TimeSpan.Zero, ...)

RCS1140 — Missing or incorrect <exception> XML doc tags

  • Wrong exception type (ArgumentExceptionArgumentOutOfRangeException) on ReportingInterval, MaximumItemCount, and SkipItemCount setters in all three classes
  • Missing tags entirely on CurrentItemCount and CurrentSkippedItemCount setters in all three classes
  • Missing ArgumentNullException tags on TransformAsync(items) and TransformAsync(items, token) in TransformerBase

Type of change

  • Bug fix

How Has This Been Tested?

  • Release build: 0 warnings, 0 errors across all target frameworks
  • All 58 existing unit tests pass; 8 skipped (no change)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Screenshots (if applicable)

N/A

Additional context

TreatWarningsAsErrors is enabled for Release configuration in Directory.Build.props, so these were hard build failures in CI despite being flagged as "warnings" by the analyzer rules.

Original prompt

Fix all failing analyzer errors in src/Wolfgang.Etl.Abstractions/TransformerBase.cs, LoaderBase.cs, and ExtractorBase.cs to ensure CI and CodeQL build pass. Specifically:

  1. For Meziantou.Analyzer MA0003: Replace all usages of unnamed lambda parameters such as '_' in Timer instantiations and similar cases with meaningful names like 'state' (or an appropriate descriptive name).
  2. For Roslynator RCS1140: Update XML documentation for methods and properties that throw exceptions. Add precise tags (such as or ) to the summary comments for every public and protected API that throws exceptions, matching the exception types/cases in the code.

Apply these fixes in:
• src/Wolfgang.Etl.Abstractions/TransformerBase.cs
• src/Wolfgang.Etl.Abstractions/LoaderBase.cs
• src/Wolfgang.Etl.Abstractions/ExtractorBase.cs

After your changes, no MA0003 or RCS1140 errors should remain, and CI/code scanning should succeed.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: Your job is failing due to two main code style issues reported by analyzers:

  1. Meziantou.Analyzer MA0003: “Name the parameter to improve code readability”
    • This means some method parameters are unnamed or use single-letter names. For example, see line 273 of TransformerBase.cs:
272|             _ => progress.Report(CreateProgressReport()),
273|             null,

The lambda parameter (_) should be replaced with a meaningful name, like state:

272|             state => progress.Report(CreateProgressReport()),

Apply this fix wherever a lambda or delegate parameter is currently unnamed (typically using just _) in TransformerBase.cs, LoaderBase.cs, and ExtractorBase.cs for any Timer instantiations.

  1. Roslynator RCS1140: “Add exception to documentation comment”
    • Some methods throw exceptions but don’t list them in their XML documentation. For example, in your property setters and public API methods, you throw ArgumentNullException or ArgumentOutOfRangeException.
    • Ensure your XML comments include a line like:
/// <exception cref="ArgumentNullException">Thrown when ...</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown when ...</exception>
  • Review public/protected methods/properties, especially those containing throw statements, and add missing tags to their XML documentation.

Addressing these issues in the files below will resolve the build failures:

  • src/Wolfgang.Etl.Abstractions/TransformerBase.cs
  • src/Wolfgang.Etl.Abstractions/LoaderBase.cs
  • src/Wolfgang.Etl.Abstractions/ExtractorBase.cs

Once these changes are made, your CodeQL job should pass.

References:

User: Create a pr to fix both issues

Assistant: I'm creating a pull request that resolves both the MA0003 (parameter naming) and RCS1140 (missing exception documentation) analyzer errors in the ETL-Abstractions source files.

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.

Copilot AI and others added 2 commits March 9, 2026 22:13
…, 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>
Copilot AI changed the title [WIP] Fix analyzer errors in TransformerBase, LoaderBase, and ExtractorBase Fix MA0003 and RCS1140 analyzer errors in TransformerBase, LoaderBase, and ExtractorBase Mar 9, 2026
@Chris-Wolfgang Chris-Wolfgang marked this pull request as ready for review March 9, 2026 22:19
Copilot AI review requested due to automatic review settings March 9, 2026 22:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Timer instantiations to name the state argument (state: null) to satisfy MA0003.
  • Added/adjusted XML <exception> tags (notably ArgumentOutOfRangeException and ArgumentNullException) to satisfy RCS1140.
  • Updated .gitignore to 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 via IncrementCurrentSkippedItemCount).
    /// <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 validates value but 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

Comment thread src/Wolfgang.Etl.Abstractions/LoaderBase.cs
Comment thread src/Wolfgang.Etl.Abstractions/TransformerBase.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

Comment on lines +74 to 76
/// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception>
public int CurrentSkippedItemCount
{
Copy link

Copilot AI Mar 9, 2026

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 (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.

Copilot uses AI. Check for mistakes.
Comment on lines +75 to 77
/// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception>
public int CurrentSkippedItemCount
{
Copy link

Copilot AI Mar 9, 2026

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, so derived classes can't set this property (it only changes via IncrementCurrentSkippedItemCount). Assign _currentSkippedItemCount = value after validation, matching CurrentItemCount's setter.

Copilot uses AI. Check for mistakes.
Comment on lines +73 to 75
/// <exception cref="ArgumentOutOfRangeException">Value cannot be less than 0</exception>
public int CurrentSkippedItemCount
{
Copy link

Copilot AI Mar 9, 2026

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 = value after the range check (consistent with CurrentItemCount).

Copilot uses AI. Check for mistakes.
@Chris-Wolfgang Chris-Wolfgang changed the base branch from main to Upgrade-newest-standards March 9, 2026 22:46
@Chris-Wolfgang Chris-Wolfgang merged commit e0a1802 into Upgrade-newest-standards Mar 9, 2026
11 of 13 checks passed
@Chris-Wolfgang Chris-Wolfgang deleted the copilot/fix-analyzer-errors-in-abstractions branch March 9, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants