mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
ansible-test pslint - fix warning with nested objects (#75792)
* ansible-test pslint - fix warning with nested objects
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible-test pslint - Fix error when encountering validation results that are highly nested - https://github.com/ansible/ansible/issues/74151
|
||||
@@ -1,7 +1,6 @@
|
||||
#Requires -Version 6
|
||||
#Requires -Modules PSScriptAnalyzer, PSSA-PSCustomUseLiteralPath
|
||||
|
||||
Set-StrictMode -Version 2.0
|
||||
$ErrorActionPreference = "Stop"
|
||||
$WarningPreference = "Stop"
|
||||
|
||||
@@ -20,14 +19,12 @@ $PSSAParams = @{
|
||||
Setting = (Join-Path -Path $PSScriptRoot -ChildPath "settings.psd1")
|
||||
}
|
||||
|
||||
$Results = @()
|
||||
|
||||
ForEach ($Path in $Args) {
|
||||
$Results = @(ForEach ($Path in $Args) {
|
||||
$Retries = 3
|
||||
|
||||
Do {
|
||||
Try {
|
||||
$Results += Invoke-ScriptAnalyzer -Path $Path @PSSAParams 3> $null
|
||||
Invoke-ScriptAnalyzer -Path $Path @PSSAParams 3> $null
|
||||
$Retries = 0
|
||||
}
|
||||
Catch {
|
||||
@@ -37,6 +34,8 @@ ForEach ($Path in $Args) {
|
||||
}
|
||||
}
|
||||
Until ($Retries -le 0)
|
||||
}
|
||||
})
|
||||
|
||||
ConvertTo-Json -InputObject $Results
|
||||
# Since pwsh 7.1 results that exceed depth will produce a warning which fails the process.
|
||||
# Ignore warnings only for this step.
|
||||
ConvertTo-Json -InputObject $Results -Depth 1 -WarningAction SilentlyContinue
|
||||
|
||||
Reference in New Issue
Block a user