Skip to content

refactor: Extract duplicate dotnet format logic into helper method#1464

Merged
thomhurst merged 9 commits into
mainfrom
fix/issue-1460-format-dry
Dec 30, 2025
Merged

refactor: Extract duplicate dotnet format logic into helper method#1464
thomhurst merged 9 commits into
mainfrom
fix/issue-1460-format-dry

Conversation

@thomhurst

Copy link
Copy Markdown
Owner

Summary

  • Extracted 4 nearly identical DotNetFormatOptions configurations into a single reusable RunDotNetFormat helper method
  • Helper method accepts parameters for whitespaceOnly and verifyNoChanges to handle all variations
  • Reduces code duplication from ~40 lines to ~16 lines

Fixes #1460

Test plan

  • Verify the module behavior remains unchanged (whitespace formatting with verification, full formatting with verification, and both without verification for auto-fix scenarios)
  • CI build passes

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Extracts duplicate dotnet format configuration logic into a reusable helper method to reduce code duplication.

Critical Issues

None found ✅

Suggestions

None - this is a clean refactoring that correctly preserves all four formatting variations (whitespace/full × verify/no-verify) while reducing duplication from ~40 lines to ~16 lines.

Verdict

APPROVE - No critical issues

The helper method correctly handles all cases:

  • Arguments is set to ["whitespace"] when whitespaceOnly=true, or null when false
  • VerifyNoChanges is parameterized correctly
  • All other properties (WorkingDirectory, Severity) remain consistent across all invocations

@thomhurst thomhurst enabled auto-merge (squash) December 30, 2025 02:45
@thomhurst thomhurst disabled auto-merge December 30, 2025 02:52
@thomhurst thomhurst merged commit 2b4e59a into main Dec 30, 2025
10 of 12 checks passed
@thomhurst thomhurst deleted the fix/issue-1460-format-dry branch December 30, 2025 02:53
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.

MEDIUM: Duplicate format verification logic in CodeFormattedNicelyModule

1 participant