From fe4def773996201394af79bae3baf605d01402f3 Mon Sep 17 00:00:00 2001 From: Darii Nurgaleev Date: Tue, 13 Oct 2020 17:24:06 +0700 Subject: [PATCH] resolve comments. --- images.CI/lint-shebang.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/images.CI/lint-shebang.ps1 b/images.CI/lint-shebang.ps1 index 6a2789f5..ffed13bd 100644 --- a/images.CI/lint-shebang.ps1 +++ b/images.CI/lint-shebang.ps1 @@ -12,20 +12,22 @@ function Validate-Scripts { [Parameter(Mandatory=$true)] [string]$Pattern ) - $ScriptsWithBrokenShebang = @() + $ScriptWithoutShebangLine = @() Get-ChildItem $path | ForEach-Object { if (Get-Content -Path $($_.FullName) | Select-Object -First 1 | Select-String -Pattern $Pattern -Quiet) { Write-Host "Pattern '$Pattern' found in '$($_.FullName)'" } else { Write-Host "Pattern '$Pattern' not found in '$($_.FullName)'" - $ScriptsWithBrokenShebang += $($_.FullName) + $ScriptWithoutShebangLine += $($_.FullName) } } - return $ScriptsWithBrokenShebang + return $ScriptWithoutShebangLine } -$ScriptsWithBrokenShebang = Validate-Scripts -Path $path -Pattern "#!/bin/bash -e" +$ScriptsWithBrokenShebang = @() +$ScriptsWithBrokenShebang += Validate-Scripts -Path $path1 -Pattern "#!/bin/bash -e" +$ScriptsWithBrokenShebang += Validate-Scripts -Path $path2 -Pattern "#!/bin/bash -e" if ($ScriptsWithBrokenShebang.Length -gt 0) { $ScriptsWithBrokenShebang | ForEach-Object { Write-Warning "The following script does not contain shebang: '$_'"