Repository navigation
(MAINT) Update PowerShell adapter code for PSSA - #1770
Open
Mikey Lombardi (He/Him) (michaeltlombardi) wants to merge 1 commit into
Open
Mikey Lombardi (He/Him) (michaeltlombardi) wants to merge 1 commit into
Mikey Lombardi (He/Him) (michaeltlombardi) wants to merge 1 commit into
Conversation
Prior to this change the PowerShell adapter script and module files raised numerous errors, warnings, and lower severity violations for PSScriptAnalyzer. This change updates the source code to fix or explicitly suppress the violation rules without changing code functionality. The most common fixes are: - Using parameters explicitly instead of positionally - Suppressing false positives for `PSUseDeclaredVarsMoreThanAssignments` - Moving function code into the `process` block when a function supports input from the pipeline instead of defining directly in the body
Mikey Lombardi (He/Him) (michaeltlombardi)
marked this pull request as ready for review
October 22, 2026 13:56
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-version validation on Windows PowerShell 5.1 and PowerShell 7 is needed to confirm that the process-block refactoring preserves adapter behavior.
No open issues 🎉
What changed in this PR
This PR cleans up the PowerShell DSC adapter scripts for PSScriptAnalyzer, with the stated intent of preserving existing behavior.
Changes:
- Adds explicit parameter names and targeted analyzer suppressions.
- Moves pipeline-capable function bodies into
processblocks. - Renames helpers and updates their call sites, while removing unused module-import assignments.
| File | Description |
|---|---|
| adapters/powershell/psDscAdapter/win_psDscAdapter.psm1 | Applies analyzer cleanup and process-block refactoring to the Windows PowerShell adapter. |
| adapters/powershell/psDscAdapter/psDscAdapter.psm1 | Updates helper names, parameter usage, suppressions, and pipeline processing. |
| adapters/powershell/psDscAdapter/powershell.resource.ps1 | Updates tracing and operation dispatch with process blocks and explicit parameters. |
Review effort: Balanced
Copilot started reviewing on behalf of
Mikey Lombardi (He/Him) (michaeltlombardi)
October 22, 2026 14:03
Steve Lee (SteveL-MSFT)
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
This change updates the source code to fix or explicitly suppress the violation rules without changing code functionality.
The most common fixes are:
PSUseDeclaredVarsMoreThanAssignmentsprocessblock when a function supports input from the pipeline instead of defining directly in the bodyPR Context
Prior to this change the PowerShell adapter script and module files raised numerous errors, warnings, and lower severity violations for PSScriptAnalyzer.