Open
Description
Problem
A repository-wide script check still finds multiple .ps1 files that do not follow the MSX PowerShell script baseline (#Requires -Version, script-level [CmdletBinding()], param(), and $ErrorActionPreference = 'Stop').
Current status
A first pass has already aligned the workflow/deployment scripts under:
.github/scripts/docs/*.ps1.github/actions/update-index/src/Invoke-UpdateIndex.ps1- helper module naming for the
update-indexaction (update-index.Helpers.psm1)
Remaining files flagged
.github/scripts/docs/Shared.ps1(helper script shape differs from entry-script baseline)guidance/*.ps1examples:Add-Array.ps1Add-HashTable.ps1Add-String.ps1Caller.ps1ClassExtension.ps1Loops.ps1Out-Null.ps1PipelineExecution.ps1PSCallStack.ps1PSCmdlet.ps1Read-File.ps1root.ps1WebCalls.ps1
Proposed resolution
- Decide policy for
guidance/*.ps1(strict runnable-script baseline vs snippet-style examples). - If strict baseline applies, align each file to the standard structure and help format.
- If snippet style is intentional, document the exception clearly in repo guidance and exclude from baseline checks.
- Normalize
Shared.ps1by either:- converting it to a helper module (
*.psm1) with explicit import usage, or - documenting why helper script format is intentionally exempt.
- converting it to a helper module (
Metadata
Metadata
Assignees
Labels
No labels
Activity
MariusStorhaug commentedon Nov 4, 2026
The native-help review for #558 reads all 14 guidance files and preserves them under the complete-blob contract in docs/content/reference/guidance-scripts.md. The policy decision in this issue still applies before a writing-only pass changes those snapshots. Two concrete semantic findings also need separate verification: guidance/Read-File.ps1 line 15 uses
$InputText.Length > 0; the PowerShell parser identifies> 0as FileRedirectionAst, while its help promises a Boolean result. guidance/PSModuleTest.psm1 says to dot-source each file but calls Import-Module. #570 changes neither behavior nor guidance content and does not claim that these examples are corrected.