From 6684d61240df707ba2ceed4294024ddd022c3f46 Mon Sep 17 00:00:00 2001 From: Jonathan Butler Date: Tue, 19 Nov 2024 16:52:37 -0500 Subject: [PATCH] Update pscriptanalyzer.yaml to use Node20 instead of deprecatated Node16 --- .github/workflows/psscriptanalzyer.yml | 13 +++++++++++-- Hawk/tests/general/Test-PreCommitHook.ps1 | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/psscriptanalzyer.yml b/.github/workflows/psscriptanalzyer.yml index df471b6..01f2d25 100644 --- a/.github/workflows/psscriptanalzyer.yml +++ b/.github/workflows/psscriptanalzyer.yml @@ -32,13 +32,22 @@ jobs: - name: Run PSScriptAnalyzer shell: pwsh run: | - $settings = Join-Path $env:GITHUB_WORKSPACE '.github/psscriptanalyzer/PSScriptAnalyzerSettings.psd1' + # Verify settings file exists + $settingsPath = Join-Path $env:GITHUB_WORKSPACE '.github/psscriptanalyzer/PSScriptAnalyzerSettings.psd1' + if (-not (Test-Path $settingsPath)) { + Write-Error "PSScriptAnalyzer settings file not found at: $settingsPath" + Write-Host "Directory contents:" + Get-ChildItem -Path $env:GITHUB_WORKSPACE/.github -Recurse + exit 1 + } + $results = @() # Analyze all PowerShell files Get-ChildItem -Path $env:GITHUB_WORKSPACE -Recurse -Include *.ps1,*.psm1,*.psd1 | ForEach-Object { - $analysis = Invoke-ScriptAnalyzer -Path $_.FullName -Settings $settings + Write-Host "Analyzing $($_.FullName)" + $analysis = Invoke-ScriptAnalyzer -Path $_.FullName -Settings $settingsPath if ($analysis) { $results += $analysis } diff --git a/Hawk/tests/general/Test-PreCommitHook.ps1 b/Hawk/tests/general/Test-PreCommitHook.ps1 index 007eb8e..cb77a1f 100644 --- a/Hawk/tests/general/Test-PreCommitHook.ps1 +++ b/Hawk/tests/general/Test-PreCommitHook.ps1 @@ -5,7 +5,7 @@ # 3. Observe the PSScriptAnalyzer warnings/errors #region Good Code Examples - These will pass PSScriptAnalyzer -# add comment to test this +# add comment to test function Test-GoodFunction { [CmdletBinding()] param (