mirror of
https://github.com/warpdotdev/warp.git
synced 2026-05-07 07:38:59 +08:00
31 lines
857 B
PowerShell
Executable File
31 lines
857 B
PowerShell
Executable File
#!/usr/bin/env -S pwsh -NoProfile
|
|
|
|
param(
|
|
[switch]$ci,
|
|
[switch]$fix
|
|
)
|
|
|
|
$rulesFile = './.PSScriptAnalyzerSettings.psd1'
|
|
$sources = @(
|
|
'./app/assets/bundled/bootstrap/',
|
|
'./script/windows/'
|
|
)
|
|
|
|
foreach ($source in $sources) {
|
|
Write-Output "Inspecting scripts in '$source'"
|
|
$scriptAnalyzerParams = @{
|
|
Settings = $rulesFile
|
|
Path = $source
|
|
ReportSummary = $true
|
|
Recurse = $true
|
|
Fix = $fix
|
|
}
|
|
$results = Invoke-ScriptAnalyzer @scriptAnalyzerParams
|
|
Write-Output $results
|
|
$errorsAndWarnings = $results | Where-Object { $_.Severity -ge [Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticSeverity]::Warning }
|
|
$problemCount = ($errorsAndWarnings | Measure-Object).Count
|
|
if ($problemCount -gt 0 -and $ci) {
|
|
throw "Lint failed with $problemCount problems"
|
|
}
|
|
}
|