Skip to content

style: enforce quoted literals, named parameters, and parameter validation #35

@tablackburn

Description

@tablackburn

Background

instructions/powershell.instructions.md mandates three rules for in-tree code:

  • Literal string parameter values are single-quoted (e.g., -Method 'Post', not -Method Post)
  • Cmdlet calls use named parameters (when more than one argument is passed) (e.g., Split-Path -Path $p -Parent, not Split-Path -Parent $p)
  • Every function parameter has an appropriate validator ([ValidateNotNullOrEmpty()], [ValidateRange], [ValidateSet], etc.)

These rules were applied to tablackburn/JsmOperations (PR #2) and the upstream tablackburn/PowerShellModuleTemplate (PR #23). This repo's first-party code hasn't been swept yet.

The recent line-ending normalization (PR #34) didn't touch the style rules above.

Scope

Apply the rules to:

  • build.ps1
  • Module source (ScheduledTasksManager/Public/*.ps1, ScheduledTasksManager/Private/*.ps1, ScheduledTasksManager/ScheduledTasksManager.psm1)
  • First-party test files (the ones written for this module — tests/*.Tests.ps1)

Out of scope

Template-derived files come from tablackburn/PowerShellModuleTemplate and are tracked separately:

  • tests/Help.tests.ps1
  • tests/Manifest.tests.ps1
  • tests/Meta.tests.ps1
  • tests/MetaFixers.psm1
  • tests/ManifestHelpers.psm1

tests/Integration/Start-IntegrationLab.ps1 is integration-test scaffolding — review separately.

Reference

tablackburn/JsmOperations#2 shows the canonical shape of these changes applied to a real module. The commits stacked on feature/v0.1.0-mvp walk through it (style sweep → naming refactor → expand-shorthand passes).

Acceptance criteria

  • All in-scope style violations resolved
  • ./build.ps1 still passes (PSScriptAnalyzer + Pester clean, coverage threshold preserved)
  • Single-arg Write-Verbose / Write-Output / etc. stay positional (the rule is "named unless only one parameter")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions