Ado/Steps/RunScriptCop.ps1
param([string]$ModulePath) Import-Module ScriptCop, PSDevOps -PassThru | Out-Host if (-not $ModulePath) { $orgName, $moduleName = $env:BUILD_REPOSITORY_ID -split "/" $ModulePath = ".\$moduleName.psd1" } if ($ModulePath -like '*PSDevOps*') { Remove-Module PSDeVOps # If running ScriptCop on PSDeVOps, we need to remove the global module first. } "Importing from $ModulePath" | Out-Host $importedModule =Import-Module $ModulePath -Force -PassThru $importedModule | Out-Host $importedModule | Test-Command | Tee-Object -Variable scriptCopIssues | Out-Host $scriptCopIssues = $scriptCopIssues | Sort-Object ItemWithProblem foreach ($issue in $scriptCopIssues) { Write-ADOWarning -Message "$($issue.ItemWithProblem): $($issue.Problem)" } |