Skip to content

Prevent duplicate rule ID suppression errors in -Fix and DSC scenarios#2181

Open
liamjpeters wants to merge 1 commit intoPowerShell:mainfrom
liamjpeters:DuplicateFixSuppressionError
Open

Prevent duplicate rule ID suppression errors in -Fix and DSC scenarios#2181
liamjpeters wants to merge 1 commit intoPowerShell:mainfrom
liamjpeters:DuplicateFixSuppressionError

Conversation

@liamjpeters
Copy link
Copy Markdown
Contributor

PR Summary

  • When using -Fix, only emit errors for unused rule suppressions IDs on the final pass - not intermediate Fix() passes.
  • Make the two DSC branches mutually exclusive (skip the module-layout branch when the class-based branch already handled the AST). Prevents multiple copies of unused rule suppression ID error.

Added regression tests covering these 2 scenarios.

Fixes #2177

PR Checklist

@liamjpeters liamjpeters requested review from a team and bergmeister as code owners April 28, 2026 19:01
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.

Duplicate "Cannot find any DiagnosticRecord with the Rule Suppression ID" errors with -Fix and class-based DSC resources

1 participant