Skip to content

Align remaining PowerShell scripts with MSX script standard #76

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-index action (update-index.Helpers.psm1)

Remaining files flagged

  • .github/scripts/docs/Shared.ps1 (helper script shape differs from entry-script baseline)
  • guidance/*.ps1 examples:
    • Add-Array.ps1
    • Add-HashTable.ps1
    • Add-String.ps1
    • Caller.ps1
    • ClassExtension.ps1
    • Loops.ps1
    • Out-Null.ps1
    • PipelineExecution.ps1
    • PSCallStack.ps1
    • PSCmdlet.ps1
    • Read-File.ps1
    • root.ps1
    • WebCalls.ps1

Proposed resolution

  1. Decide policy for guidance/*.ps1 (strict runnable-script baseline vs snippet-style examples).
  2. If strict baseline applies, align each file to the standard structure and help format.
  3. If snippet style is intentional, document the exception clearly in repo guidance and exclude from baseline checks.
  4. Normalize Shared.ps1 by either:
    • converting it to a helper module (*.psm1) with explicit import usage, or
    • documenting why helper script format is intentionally exempt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions