Skip to content

Add code fixer for MA0175 (Remove explicit class keyword from record declarations)#1069

Merged
meziantou merged 2 commits intomainfrom
copilot/implement-fixer-for-ma0175
Mar 30, 2026
Merged

Add code fixer for MA0175 (Remove explicit class keyword from record declarations)#1069
meziantou merged 2 commits intomainfrom
copilot/implement-fixer-for-ma0175

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

MA0175 flagged record class declarations but had no code fix to act on the diagnostic. This adds the fixer and corrects a copy-paste error in the rule's documentation.

Changes

  • New fixer RecordClassDeclarationShouldBeImplicitFixer: removes the class keyword from record class declarations, preserving surrounding trivia
  • Tests: added WithCodeFixProvider to the existing test builder and three fix-validation test cases (basic, with modifiers, with parameters)
  • Docs: corrected MA0175 description (was incorrectly describing MA0174's behaviour); documentation tables updated to reflect ✔️ code-fix availability

Example

// Before (MA0175 diagnostic)
public sealed record class Customer(int Id);

// After fix
public sealed record Customer(int Id);

…d from record declaration)

Agent-Logs-Url: https://github.com/meziantou/Meziantou.Analyzer/sessions/86df07a0-7d5f-4758-893e-5af1d6f78760

Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com>
Copilot AI changed the title [WIP] Add fixer for MA0175 code analysis rule Add code fixer for MA0175 (Remove explicit class keyword from record declarations) Mar 30, 2026
Copilot AI requested a review from meziantou March 30, 2026 15:29
@meziantou meziantou marked this pull request as ready for review March 30, 2026 16:16
@meziantou meziantou merged commit ff70670 into main Mar 30, 2026
13 checks passed
@meziantou meziantou deleted the copilot/implement-fixer-for-ma0175 branch March 30, 2026 16:25
This was referenced Mar 30, 2026
This was referenced Mar 31, 2026
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.

2 participants