Skip to content

Fix PSScriptAnalyzer identified issues - #948

Merged
aaronparker merged 6 commits into
mainfrom
PSScriptAnalyzer
Nov 4, 2026
Merged

aaronparker merged 6 commits into
mainfrom
PSScriptAnalyzer

Conversation

@aaronparker

Copy link
Copy Markdown
Collaborator

Warning

The module now requires Windows PowerShell 5.1 or PowerShell 7.4 or later on Windows, macOS, or Linux; PowerShell 4.0 or PowerShell 6/7.0-7.3 are no longer supported.

  • Supported runtimes: Raise the minimum supported PowerShell 7 version to 7.4 while retaining Windows PowerShell 5.1 support. Update the CI runtime matrix, syntax checks, test setup, and support documentation.
    • Confirmation and preview — Update-Evergreen, Remove-ProxyEnv: Add -WhatIf and -Confirm support. Guard the entire cache update before downloads or cache changes, and guard each proxy variable removal. Add regression coverage and document cache update confirmation behavior.
  • Analyzer compliance and compatibility: Resolve configured PSScriptAnalyzer findings with targeted compatibility suppressions for platform-guarded code, naming and keyword corrections, and encoding fixes. Preserve default automatic date detection without a default-enabled switch parameter, and use Unicode escapes in CAB path validation.
  • Diagnostics — Save-EvergreenApp, Update-Evergreen: Warn when retry-response status codes or Retry-After headers cannot be parsed, and route cache hash-validation failures through Write-Message with the appropriate message type.

Replace literal superscript digits with Unicode escapes in the reserved device-name regex, preserving validation while keeping the source ASCII-only.
Update the runtime matrix, syntax checks, and support documentation while retaining Windows PowerShell 5.1 support. Add ShouldProcess coverage for proxy removal and cache updates, including WhatIf safety and confirmation handling.
Add -WhatIf and -Confirm to Update-Evergreen, with approval covering the full cache operation, and document the new behavior. Also adjust PowerShell compatibility suppressions, date parsing defaults, proxy cleanup, and retry-response diagnostics.
@aaronparker aaronparker self-assigned this Nov 4, 2026
@aaronparker aaronparker added bug Something isn't working enhancement New feature or request labels Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Test Results

    6 files  ±  0  2 296 suites  +37   7m 52s ⏱️ -56s
2 501 tests + 32  2 470 ✅ + 34   31 💤  - 2  0 ❌ ±0 
9 477 runs  +273  9 279 ✅ +268  198 💤 +5  0 ❌ ±0 

Results for commit a595ae9. ± Comparison against base commit 222e18b.

This pull request removes 195 and adds 224 tests. Note that renamed tests count towards both.

Expand-CabArchive.Validate Shell extraction and expand.exe fallback.Should retry with expand.exe when Shell returns <Case> items("empty",)
Expand-CabArchive.Validate Shell extraction and expand.exe fallback.Should retry with expand.exe when Shell returns <Case> items("null",null)
Get-EvergreenApp works with supported application: AdoptiumTemurin19.Application function AdoptiumTemurin19 should return something.Get-EvergreenApp -Name AdoptiumTemurin19 should return a count of 1 or more
Get-EvergreenApp works with supported application: AdoptiumTemurin19.Application function AdoptiumTemurin19 should return something.Get-EvergreenApp -Name AdoptiumTemurin19 should return non-empty output
Get-EvergreenApp works with supported application: AdoptiumTemurin19.Application function AdoptiumTemurin19 should return something.Output from AdoptiumTemurin19 should return the expected output type
Get-EvergreenApp works with supported application: AdoptiumTemurin19.Output from application function AdoptiumTemurin19 returns expected properties.Output for AdoptiumTemurin19 should have a URI property that is a string
Get-EvergreenApp works with supported application: AdoptiumTemurin19.Output from application function AdoptiumTemurin19 returns expected properties.Output for AdoptiumTemurin19 should have a Version property that is a string
Get-EvergreenApp works with supported application: AdoptiumTemurin19.Output from application function AdoptiumTemurin19 returns expected properties.Output for AdoptiumTemurin19 should have a valid version number
Get-EvergreenApp works with supported application: AdoptiumTemurin22.Application function AdoptiumTemurin22 should return something.Get-EvergreenApp -Name AdoptiumTemurin22 should return a count of 1 or more
…
Expand-CabArchive.Validate Shell extraction and expand.exe fallback.Should not replace an existing destination directory with a CAB file
Expand-CabArchive.Validate Shell extraction and expand.exe fallback.Should promote nested CAB entries and create their destination directories
Expand-CabArchive.Validate Shell extraction and expand.exe fallback.Should retain staging and report errors when rollback cannot restore a backup
Get-EvergreenApp works with supported application: 7zip.Application function 7zip should return something.Get-EvergreenApp -Name 7zip should return a count of 1 or more
Get-EvergreenApp works with supported application: 7zip.Application function 7zip should return something.Get-EvergreenApp -Name 7zip should return non-empty output
Get-EvergreenApp works with supported application: 7zip.Application function 7zip should return something.Output from 7zip should return the expected output type
Get-EvergreenApp works with supported application: 7zip.Output from application function 7zip returns expected properties.Output for 7zip should have a URI property that is a string
Get-EvergreenApp works with supported application: 7zip.Output from application function 7zip returns expected properties.Output for 7zip should have a Version property that is a string
Get-EvergreenApp works with supported application: 7zip.Output from application function 7zip returns expected properties.Output for 7zip should have a valid version number
Get-EvergreenApp works with supported application: AdoptiumTemurin11.Application function AdoptiumTemurin11 should return something.Get-EvergreenApp -Name AdoptiumTemurin11 should return a count of 1 or more
…

♻️ This comment has been updated with latest results.

Replace network-dependent update tests with mocked cache and hash-validation scenarios. Add coverage for CAB rollback, HTTP options and TLS restoration, and download failures; include update tests in the default run.
Clear module-scoped proxy settings after each test and verify subsequent REST and web requests receive no proxy settings or credentials.
@aaronparker
aaronparker merged commit eb533f4 into main Nov 4, 2026
12 checks passed
@aaronparker
aaronparker deleted the PSScriptAnalyzer branch November 4, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant