Skip to content

feat(LC0095, LC0099): split unreferenced-parameter rule into LC0095 and LC0099 - #425

Open
MODUSCarstenScholling wants to merge 1 commit into
ALCops:mainfrom
MODUSCarstenScholling:dev-cs-paramnotref-split+fixall
Open

feat(LC0095, LC0099): split unreferenced-parameter rule into LC0095 and LC0099#425
MODUSCarstenScholling wants to merge 1 commit into
ALCops:mainfrom
MODUSCarstenScholling:dev-cs-paramnotref-split+fixall

Conversation

@MODUSCarstenScholling

@MODUSCarstenScholling MODUSCarstenScholling commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR splits the previous unreferenced-parameter behavior into two diagnostics with clear scope boundaries:

  • LC0095: regular non-local procedures (internal/public), severity Warning
  • LC0099: event subscribers, severity Info

It also keeps a shared code fix implementation and updates tests and documentation accordingly.

What changed

  • Analyzer:

    • Added LC0099 descriptor and routing in ParameterNotReferenced analyzer
    • Kept LC0095 for non-subscriber paths only
  • Code fix:

    • Shared provider handles both LC0095 and LC0099
    • Distinct equivalence keys for regular procedures vs event subscribers
    • Custom Fix All kept and refined for shared separated-list edits
    • Preserved fallback behavior for empty fixAllSpans document scope
  • Tests:

    • Added/updated subscriber-specific diagnostic and fix coverage
    • Added/updated fix-all coverage for both scopes
    • Renamed cases for clearer intent and consistency

Why

AA0137 does not cover this full space:

  • It handles local procedures only
  • Event subscribers need separate guidance and a lower-friction severity

Splitting the diagnostics improves clarity, allows better policy tuning, and keeps fix behavior deterministic.

Validation

  • Focused tests for ParameterNotReferenced pass
  • Solution test run passes in the current workspace
  • CI-targeted compatibility behavior for multi-target builds remains respected

Breaking changes

No runtime breaking changes.
Diagnostic behavior changes:

  • Event subscriber findings now report as LC0099 instead of LC0095.

Implements #426

…nd LC0099

Separate unreferenced parameter diagnostics by procedure kind:
- Keep LC0095 for regular non-local procedures (internal/public)
- Introduce LC0099 for event subscribers (Info severity)

Implement a shared code fix provider for both diagnostics:
- Keep scoped equivalence keys for regular procedures and event subscribers
- Use custom Fix All with one-pass RemoveNodes on separated parameter lists
- Keep fallback behavior when fixAllSpans is empty in document scope

Improve maintainability and consistency:
- Align naming in tests and fix-all scenarios
- Keep netstandard2.1 compatibility behavior intact

Expand and update test coverage:
- Add and adjust diagnostic, single-fix, and fix-all cases for both scopes
- Verify focused ParameterNotReferenced test suite passes
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.

1 participant